Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
move tests from core-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiefu committed Sep 9, 2014
1 parent cdeb303 commit 686fac3
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"private": true,
"dependencies": {
"polymer": "Polymer/polymer#master"
},
"devDependencies": {
"polymer-test-tools": "Polymer/polymer-test-tools#master"
}
}
71 changes: 71 additions & 0 deletions tests/html/core-collapse.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!doctype html>
<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>core-collapse</title>

<script src="../../../platform/platform.js"></script>
<script src="../../../polymer-test-tools/chai/chai.js"></script>
<script src="../../../polymer-test-tools/htmltest.js"></script>


<link rel="import" href="../../core-collapse.html">

</head>
<body unresolved>

<button onclick="document.querySelector('#collapse').toggle()">toggle collapse</button>

<core-collapse id="collapse" duration="0.1" opened>
<div>
Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem
</div>
</core-collapse>

<script>

var delay = 200;
document.addEventListener('polymer-ready', function() {
var assert = chai.assert;
var c = document.querySelector('#collapse');
// verify take attribute for opened is correct
assert.equal(c.opened, true);
setTimeout(function() {
// get the height for the opened state
var h = getCollapseComputedStyle().height;
// verify the height is not 0px
assert.notEqual(getCollapseComputedStyle().height, '0px');
// close it
c.opened = false;
Platform.flush();
setTimeout(function() {
// verify is closed
assert.notEqual(getCollapseComputedStyle().height, h);
// open it
c.opened = true;
Platform.flush();
setTimeout(function() {
// verify is opened
assert.equal(getCollapseComputedStyle().height, h);
done();
}, delay);
}, delay);
}, delay);
});

function getCollapseComputedStyle() {
var b = document.querySelector('#collapse');
return getComputedStyle(b);
}

</script>

</body>
</html>
3 changes: 3 additions & 0 deletions tests/js/htmltests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
htmlSuite('core-collapse', function() {
htmlTest('html/core-collapse.html');
});
14 changes: 14 additions & 0 deletions tests/runner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype htmlz>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>Web Component Test Runner</title>
<script src="../../polymer-test-tools/ci-support.js"></script>
</head>
<body>
<script>
runTests('tests.json');
</script>
</body>
</html>
6 changes: 6 additions & 0 deletions tests/tests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tools": ["chai", "mocha-tdd"],
"tests": [
"js/htmltests.js"
]
}

0 comments on commit 686fac3

Please sign in to comment.