generator-polymer-init-valle-element
Version:
Generator for valle elements using Polymer 2x
54 lines (41 loc) • 1.46 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title><%= elementName %> basic test</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../<%= elementName %>.html">
</head>
<body>
<test-fixture id="basicTestFixture">
<template>
<<%= elementName %>></<%= elementName %>>
</template>
</test-fixture>
<test-fixture id="testFixtureWithProp">
<template>
<<%= elementName %> prop1="Humans"></<%= elementName %>>
</template>
</test-fixture>
<script>
suite('<%= elementName %>', () => {
let basicElement,
elementWithProp;
setup(() => {
basicElement = fixture('basicTestFixture');
elementWithProp = fixture('testFixtureWithProp');
});
test('Should render the element with default <h1> text', () => {
const h1 = basicElement.shadowRoot.querySelector('h1');
assert.equal(h1.textContent, 'Hello World!');
});
test('Should render the element with prop1', () => {
assert.equal(elementWithProp.prop1, 'Humans');
});
});
</script>
</body>
</html>