Last active
January 18, 2018 13:23
-
-
Save mraerino/fce691640d4798454dc485ae559f6bb4 to your computer and use it in GitHub Desktop.
Testing Fit-Html components using Web-Component-Tester
This file contains hidden or 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
suite('ShadowRoot', function() { | |
test('ShadowRoot exists', function() { | |
const Component = FitHtml.connect( | |
() => console.log('state props called'), | |
{}, | |
() => FitHtml.html`` | |
); | |
customElements.define('test-has-shadow-root', Component); | |
litHtml.render(litHtml.html` | |
<test-has-shadow-root id="test"></test-has-shadow-root> | |
`, testFixture); | |
assert.isNotNull(document.getElementById('test').shadowRoot); | |
}); | |
}); |
This file contains hidden or 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="../node_modules/web-component-tester/browser.js"></script> | |
<script src="../dist/bundled/index.js"></script> | |
</head> | |
<body> | |
<store-provider> | |
<div id="fixture"></div> | |
</store-provider> | |
<script type="module"> | |
import * as LitHtml from '../node_modules/lit-html/lit-html.js'; | |
window.litHtml = LitHtml; | |
window.testFixture = document.getElementById('fixture'); | |
customElements.define('store-provider', FitHtml.createProvider({ | |
subscribe: () => {}, | |
getState: () => {} | |
})); | |
WCT.loadSuites([ | |
'has-shadow-root.js', | |
]); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment