-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
92 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
const path = require("path"); | ||
const config = require("@patternslib/dev/jest.config.js"); | ||
|
||
// config.setupFilesAfterEnv.push("./node_modules/@testing-library/jest-dom/extend-expect"); | ||
config.setupFilesAfterEnv.push(path.resolve(__dirname, "./src/setup-tests.js")); | ||
config.transformIgnorePatterns = [ | ||
"/node_modules/(?!@patternslib/)(?!@plone/)(?!preact/)(?!screenfull/)(?!sinon/)(?!bootstrap/)(?!datatable/).+\\.[t|j]sx?$", | ||
"/node_modules/(?!@patternslib/)(?!@plone/)(?!preact/)(?!screenfull/)(?!sinon/)(?!bootstrap/)(?!datatable/)(?!svelte/).+\\.[t|j]sx?$", | ||
]; | ||
|
||
// add svelte-jester | ||
config.transform["^.+\\.svelte$"] = "svelte-jester"; | ||
|
||
console.log(JSON.stringify(config, null, 4)); | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import "./contentbrowser"; | ||
import registry from "@patternslib/patternslib/src/core/registry"; | ||
import utils from "@patternslib/patternslib/src/core/utils"; | ||
|
||
|
||
describe("Content Browser", () => { | ||
beforeEach(() => { | ||
let options = { | ||
vocabularyUrl: "/contentbrowser-test.json", | ||
} | ||
document.body.innerHTML = ` | ||
<div id="contentbrowser-field"> | ||
<input type="text" value="" class="pat-contentbrowser" data-pat-contentbrowser="${JSON.stringify(options)}"> | ||
</div> | ||
`; | ||
}); | ||
|
||
afterEach(() => { | ||
document.body.innerHTML = ""; | ||
}); | ||
|
||
it("create contentbrowser pattern without preselection", async function () { | ||
expect(document.querySelectorAll(".content-browser-wrapper").length).toEqual(0); | ||
|
||
registry.scan(document.body); | ||
await utils.timeout(1); | ||
|
||
expect(document.querySelectorAll(".content-browser-wrapper").length).toEqual(1); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters