-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-conventions): enable ShadomDOM option in html-only-element
closes #465
- Loading branch information
Showing
8 changed files
with
282 additions
and
149 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
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
91 changes: 0 additions & 91 deletions
91
packages/__tests__/plugin-conventions/strip-html-import.spec.ts
This file was deleted.
Oops, something went wrong.
160 changes: 160 additions & 0 deletions
160
packages/__tests__/plugin-conventions/strip-meta-data.spec.ts
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,160 @@ | ||
import { stripMetaData } from '@aurelia/plugin-conventions'; | ||
import { assert } from '@aurelia/testing'; | ||
|
||
describe('stripMetaData', function () { | ||
it('returns empty html', function() { | ||
assert.deepEqual(stripMetaData(' '), { | ||
html: ' ', | ||
shadowMode: null, | ||
deps: [] | ||
}); | ||
}); | ||
|
||
it('strips import tag', function() { | ||
const html = `<import from="./a"></import> | ||
<template> | ||
<p></p> | ||
</template> | ||
`; | ||
const expected = ` | ||
<template> | ||
<p></p> | ||
</template> | ||
`; | ||
|
||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: null, | ||
deps: ['./a'] | ||
}); | ||
}); | ||
|
||
it('strips import tags with wrong or missing close tag', function() { | ||
const html = `<import from="./a" /> | ||
<import from="b"></import> | ||
<template> | ||
<import from="./c.css"> | ||
<p></p> | ||
</template> | ||
`; | ||
const expected = ` | ||
<template> | ||
${' ' /* leading space is untouched */} | ||
<p></p> | ||
</template> | ||
`; | ||
|
||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: null, | ||
deps: ['./a', 'b', './c.css'] | ||
}); | ||
}); | ||
|
||
it('strips require tag', function() { | ||
const html = `<require from="./a"></require> | ||
<template> | ||
<p></p> | ||
</template> | ||
`; | ||
const expected = ` | ||
<template> | ||
<p></p> | ||
</template> | ||
`; | ||
|
||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: null, | ||
deps: ['./a'] | ||
}); | ||
}); | ||
|
||
it('strips mixed import/require tags with wrong or missing close tag', function() { | ||
const html = `<import from="./a" /><import from="foo"> | ||
<require from="b"></require> | ||
<template> | ||
<require from="./c.css"> | ||
<p></p> | ||
</template> | ||
`; | ||
const expected = ` | ||
<template> | ||
${' ' /* leading space is untouched */} | ||
<p></p> | ||
</template> | ||
`; | ||
|
||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: null, | ||
deps: ['./a', 'foo', 'b', './c.css'] | ||
}); | ||
}); | ||
|
||
it('strips use-shadow-dom tag', function() { | ||
const html = `<use-shadow-dom></use-shadow-dom> | ||
<template> | ||
</template> | ||
`; | ||
const expected = ` | ||
<template> | ||
</template> | ||
`; | ||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: 'open', | ||
deps: [] | ||
}); | ||
}); | ||
|
||
it('strips use-shadow-dom tag with mode attribute', function() { | ||
const html = `<use-shadow-dom mode="closed"> | ||
<template> | ||
<require from="./a"></require> | ||
</template> | ||
`; | ||
const expected = ` | ||
<template> | ||
</template> | ||
`; | ||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: 'closed', | ||
deps: ['./a'] | ||
}); | ||
}); | ||
|
||
it('strips use-shadow-dom attribute', function() { | ||
const html = `<template use-shadow-dom> | ||
</template> | ||
`; | ||
const expected = `<template > | ||
</template> | ||
`; | ||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: 'open', | ||
deps: [] | ||
}); | ||
}); | ||
|
||
it('strips use-shadow-dom attribute with explicit mode', function() { | ||
const html = `<template use-shadow-dom="closed"> | ||
<require from="./a"></require> | ||
</template> | ||
`; | ||
const expected = `<template > | ||
</template> | ||
`; | ||
assert.deepEqual(stripMetaData(html), { | ||
html: expected, | ||
shadowMode: 'closed', | ||
deps: ['./a'] | ||
}); | ||
}); | ||
}); |
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,5 +1,5 @@ | ||
export { nameConvention, ResourceType } from './name-convention'; | ||
export { preprocessResource } from './preprocess-resource'; | ||
export { preprocessHtmlTemplate } from './preprocess-html-template'; | ||
export { stripHtmlImport } from './strip-html-import'; | ||
export { stripMetaData } from './strip-meta-data'; | ||
export { preprocess } from './preprocess'; |
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
Oops, something went wrong.