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

Commit

Permalink
Merge branch 'wc-tester' into 2way-improved
Browse files Browse the repository at this point in the history
Conflicts:
	core-list.css
  • Loading branch information
kevinpschaaf committed Aug 22, 2014
2 parents 3732d47 + a4cc7c1 commit 619f85d
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"dependencies": {
"polymer": "Polymer/polymer#master",
"core-selection": "Polymer/core-selection#master"
},
"devDependencies": {
"polymer-test-tools": "Polymer/polymer-test-tools#wc-tester"
}
}
9 changes: 8 additions & 1 deletion core-list.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@

.core-list-viewport.horizontal > * {
display: inline-block;
}
}

/* Setting will-change: transform on the #viewport makes the viewport a
stacking context, which causes all the composited layers inside the
viewport to actually be stacked underneath the viewport. */
#viewport {
will-change: transform;
}
4 changes: 2 additions & 2 deletions core-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@

// determine proper transform mechanizm
if (document.documentElement.style.transform !== undefined) {
function setTransform(element, string, value) {
var setTransform = function(element, string, value) {
element.style.transform = string;
element._transformValue = value;
}
} else {
function setTransform(element, string, value) {
var setTransform = function(element, string, value) {
element.style.webkitTransform = string;
element._transformValue = value;
}
Expand Down
2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var gulp = require('gulp');
require('gulp-web-component-tester').init(gulp);
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"gulp": "^3.8.7"
}
}
63 changes: 63 additions & 0 deletions tests/html/core-list-basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!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-list</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<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-list.html">
<style>
html, body {
margin: 0;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
}
core-list {
display: block;
height: 100%;
margin: 0 auto;
}
</style>
</head>
<body fit>

<core-list id="list">
<template>
<div class="item {{ {selected: selected} | tokenList }}">
<div class="subject">Row: {{index}}, Record ID: {{model.id}}</div>
<input type="checkbox" checked="{{model.checked}}">
<input type="number" value="{{model.value}}" class="narrow">
<select selectedIndex="{{model.type}}"><option>a</option><option>b</option><option>c</option></select>
</div>
</template>
</core-list>

<script>
document.addEventListener('polymer-ready', function() {
// Test a property
var el = document.querySelector('core-list');
el.data = [
{id:123, checked:true, value:99, type:1},
{id:456, checked:false, value:88, type:2}
];
el.onMutation(el, function() {
chai.assert(el.children.length == el.data.length + 1,
'children.length should be 1 (template) + count of data elements');
done();
});

});

</script>

</body>
</html>
68 changes: 68 additions & 0 deletions tests/html/core-list-delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!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-list</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<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-list.html">
<style>
html, body {
margin: 0;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
}
core-list {
display: block;
height: 100%;
margin: 0 auto;
}
</style>
</head>
<body fit>

<core-list id="list">
<template>
<div class="item {{ {selected: selected} | tokenList }}">
<div class="subject">Row: {{index}}, Record ID: {{model.id}}</div>
<input type="checkbox" checked="{{model.checked}}">
<input type="number" value="{{model.value}}" class="narrow">
<select selectedIndex="{{model.type}}"><option>a</option><option>b</option><option>c</option></select>
</div>
</template>
</core-list>

<script>
document.addEventListener('polymer-ready', function() {
// Test a property
var el = document.querySelector('core-list');
el.data = [
{id:123, checked:true, value:99, type:1},
{id:456, checked:false, value:88, type:2}
];
el.onMutation(el, function() {
el.data.length = 1;
requestAnimationFrame(function() {
chai.assert(el.children.length == 2 + 1,
'children.length should be 1 (template) + count of data elements');
chai.assert(el.children[el.children.length-1].getAttribute('hidden') !== null,
'last element shoudl be hidden');
done();
});
});

});

</script>

</body>
</html>
4 changes: 4 additions & 0 deletions tests/js/htmltests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
htmlSuite('core-list', function() {
htmlTest('html/core-list-basic.html');
htmlTest('html/core-list-delete.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 619f85d

Please sign in to comment.