Skip to content

Commit

Permalink
test(test): add test
Browse files Browse the repository at this point in the history
  • Loading branch information
adominguez committed Dec 3, 2017
1 parent 5422268 commit 7f3fe47
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
67 changes: 67 additions & 0 deletions test/basic-test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../adom-demo-helper-properties.html">
</head>
<body>

<test-fixture id="default">
<template>
<adom-demo-helper-properties></adom-demo-helper-properties>
</template>
</test-fixture>

<script>
suite('<adom-demo-helper-properties>', function() {
var el;
setup(function() {
el = fixture('default');
});
suite('changes between views', function() {
test('clicking demo button change the property showDemo', function() {
el.$.buttonDemo.click();
assert.isTrue(el.showDemo);
});
test('clicking doc button change the property showDemo', function() {
el.showDemo = true;
el.$.buttonDoc.click();
assert.isFalse(el.showDemo);
});
test('clicking demo button change the styles of buttons', function() {
el.descriptorUrl = 'analysis.json';
flush(function() {
el.$.buttonDemo.click();
assert.include(el.$.selector.classList.value, 'transition');
});
});
test('clicking demo button change the styles of views', function() {
el.descriptorUrl = 'analysis.json';
flush(function() {
el.$.buttonDemo.click();
assert.include(el.$.viewDoc.classList.value, 'transition');
});
});
test('clicking demo button change the styles of views', function() {
el.descriptorUrl = 'analysis.json';
flush(function() {
el.$.buttonDemo.click();
assert.include(el.$.viewDemo.classList.value, 'transition');
});
});
});
suite('css config', function() {
test('cssUrl must be "../../component-name-styles.html"', function() {
el.descriptorUrl = 'analysis.json';
el.componentName = "my-component"
assert.equal(el.cssUrl, "../../my-component-styles.html");
});
});
});
</script>

</body>
</html>
18 changes: 18 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
// Load and run all tests (.html, .js):
WCT.loadSuites([
'basic-test.html'
]);
</script>

</body></html>

0 comments on commit 7f3fe47

Please sign in to comment.