-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add no wrapping entry tag option for renderToString (#115)
* add feature support for no wrapping entry tag option for renderToString * add docs * fix linting * fix formatting
- Loading branch information
1 parent
f39c563
commit d973b8c
Showing
4 changed files
with
73 additions
and
3 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
37 changes: 37 additions & 0 deletions
37
test/cases/no-wrapping-entry-tag/no-wrapping-entry-tag.spec.js
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,37 @@ | ||
/* | ||
* Use Case | ||
* Run wcc against bundled custom elements with no wrapping enabled. | ||
* | ||
* User Result | ||
* Should return the expected HTML with no top level wrapping tag. | ||
* | ||
* User Workspace | ||
* src/ | ||
* pages/ | ||
* no-wrap.js | ||
*/ | ||
|
||
import chai from 'chai'; | ||
import { JSDOM } from 'jsdom'; | ||
import { renderToString } from '../../../src/wcc.js'; | ||
|
||
const expect = chai.expect; | ||
|
||
describe('Run WCC For ', function() { | ||
const LABEL = 'Bundled Components w/ No Wrapping Entry TAag'; | ||
let dom; | ||
|
||
before(async function() { | ||
const { html } = await renderToString(new URL('./src/no-wrap.js', import.meta.url), false); | ||
|
||
dom = new JSDOM(html); | ||
}); | ||
|
||
describe(LABEL, function() { | ||
describe('no top level wrapping by <wcc-navigation>', function() { | ||
it('should have a <footer> tag within the <template> shadowroot', function() { | ||
expect(dom.window.document.querySelectorAll('wcc-navigation').length).to.equal(0); | ||
}); | ||
}); | ||
}); | ||
}); |
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,27 @@ | ||
class Navigation extends HTMLElement { | ||
connectedCallback() { | ||
this.innerHTML = ` | ||
<nav> | ||
<ul> | ||
<li><a href="/">Home</a></li> | ||
<li><a href="/about">About</a></li> | ||
<li><a href="/artists">Artists</a></li> | ||
<ul> | ||
</nav> | ||
`; | ||
} | ||
} | ||
|
||
customElements.define('wcc-navigation', Navigation); | ||
|
||
class Header extends HTMLElement { | ||
connectedCallback() { | ||
this.innerHTML = ` | ||
<header class="header">> | ||
<h4>My Personal Blog</h4> | ||
</header> | ||
`; | ||
} | ||
} | ||
|
||
export default Header; |