Added Polymer

This commit is contained in:
Thaum
2014-11-26 10:18:35 +00:00
parent 5eea4714b2
commit 3408ba9e8d
1210 changed files with 394645 additions and 47 deletions

View File

@@ -0,0 +1,127 @@
<!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-overlay</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../../webcomponentsjs/webcomponents.js"></script>
<script src="../../../polymer-test-tools/chai/chai.js"></script>
<script src="../../../polymer-test-tools/htmltest.js"></script>
<link rel="import" href="../../../core-transition/core-transition-css.html">
<link rel="import" href="../../core-overlay.html">
<style>
body {
margin: 0;
height: 100%;
}
#basic {
height: 200px;
width: 300px;
border: 1px solid black;
padding: 10px;
}
</style>
</head>
<body fit unresolved>
<core-overlay id="basic">
Basic Overlay
</core-overlay>
<div id="target">Targeted Overlay</div>
<core-overlay id="targeted"></core-overlay>
<core-overlay layered id="layered">
<style no-shim>
#layered {
height: 200px;
width: 300px;
border: 1px solid black;
padding: 10px;
}
</style>
Layered Overlay
</core-overlay>
<core-overlay layered backdrop id="backdrop">
<style no-shim>
#backdrop {
height: 200px;
width: 300px;
border: 1px solid black;
padding: 10px;
background-color: white;
}
</style>
Layered backdrop Overlay
</core-overlay>
<script>
document.addEventListener('polymer-ready', function() {
// setup
// basic
var basic = document.querySelector('#basic');
// targeted
var target = document.querySelector('#target');
var targeted = document.querySelector('#targeted');
targeted.target = target;
//
var layered = document.querySelector('#layered');
var backdrop = document.querySelector('#backdrop');
function testOpenEvents(element, next) {
var openingEvents = 0;
element.addEventListener('core-overlay-open', function() {
openingEvents++;
});
element.addEventListener('core-overlay-open-completed', function() {
openingEvents++;
element.async(function() {
this.opened = false;
}, 1);
});
element.addEventListener('core-overlay-close-completed', function() {
openingEvents++;
chai.assert.equal(openingEvents, 4, 'open and open-completed events fired');
next();
});
element.opened = true;
}
asyncSeries([
// basic overlay events
function(next) {
chai.assert.equal(basic.opened, false, 'overlay starts closed');
chai.assert.equal(getComputedStyle(basic).display, 'none', 'overlay starts hidden');
testOpenEvents(basic, next);
},
// targeted overlay events
function(next) {
chai.assert.equal(targeted.opened, false, 'targeted overlay starts closed');
chai.assert.equal(getComputedStyle(target).display, 'none', 'targeted overlay target starts hidden');
testOpenEvents(targeted, next);
},
// layered overlay events
function(next) {
testOpenEvents(layered, next);
},
// backdrop overlay events
function(next) {
testOpenEvents(backdrop, next);
}
], done);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,153 @@
<!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-overlay</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../../webcomponentsjs/webcomponents.js"></script>
<script src="../../../polymer-test-tools/chai/chai.js"></script>
<script src="../../../polymer-test-tools/htmltest.js"></script>
<link rel="import" href="../../../core-transition/core-transition-css.html">
<link rel="import" href="../../core-overlay.html">
<style>
body {
margin: 0;
height: 100%;
}
.sized {
height: 200px;
width: 300px;
border: 1px solid black;
padding: 10px;
margin: 16px;
}
.positioned {
top: 0;
left: 0;
}
</style>
</head>
<body unresolved>
<core-overlay class="sized" id="basic">
Sized Overlay
</core-overlay>
<core-overlay class="sized positioned" id="overlay">
Positioned Overlay
</core-overlay>
<template>
<div>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</div>
</template>
<script>
document.addEventListener('polymer-ready', function() {
// setup
var basic = document.querySelector('#basic');
var overlay = document.querySelector('#overlay');
var template = document.querySelector('template');
function testWhenOpen(element, test, next) {
var l1 = function() {
test();
element.async(function() {
element.opened = false;
}, 1);
};
var l2 = function() {
element.removeEventListener('core-overlay-open-completed', l1);
element.removeEventListener('core-overlay-close-completed', l2);
next();
};
element.addEventListener('core-overlay-open-completed', l1);
element.addEventListener('core-overlay-close-completed', l2);
element.opened = true;
}
asyncSeries([
// centered overlay
function(next) {
testWhenOpen(basic, function() {
var rect = basic.getBoundingClientRect();
chai.assert.ok(Math.abs(rect.left - (window.innerWidth - rect.right)) < 5, 'overlay centered horizontally');
chai.assert.ok(Math.abs(rect.top - (window.innerHeight - rect.bottom)) < 5, 'overlay centered vertically');
}, next);
},
// css positioned overlay
function(next) {
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.equal(rect.left, 16, 'positions via css');
chai.assert.equal(rect.top, 16, 'positions via css');
}, next);
},
// manual positioned overlay
function(next) {
overlay.style.left = overlay.style.top = 'auto';
overlay.style.right = '0px';
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.equal(rect.right, window.innerWidth - 16, 'positioned manually');
chai.assert.ok(Math.abs(rect.top - (window.innerHeight - rect.bottom)) <= 16, 'overlay centered vertically');
}, next);
},
// overflow, position top, left
function(next) {
overlay.style.left = overlay.style.top = '0px';
overlay.style.right = 'auto';
overlay.style.width = overlay.style.height = 'auto';
for (var i=0; i<20; i++) {
overlay.appendChild(template.content.cloneNode(true));
}
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
// overflow, position, bottom, right
function(next) {
overlay.style.right = overlay.style.bottom = '0px';
overlay.style.left = overlay.style.top = 'auto';
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
// overflow, unpositioned
function(next) {
overlay.style.right = overlay.style.bottom = 'auto';
overlay.style.left = overlay.style.top = 'auto';
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
// overflow, unpositioned, layered
function(next) {
overlay.layered = true;
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
], done);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,167 @@
<!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-overlay</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../../webcomponentsjs/webcomponents.js"></script>
<script src="../../../polymer-test-tools/chai/chai.js"></script>
<script src="../../../polymer-test-tools/htmltest.js"></script>
<link rel="import" href="../../../core-transition/core-transition-css.html">
<link rel="import" href="../../core-overlay.html">
<style>
body {
margin: 0;
height: 100%;
}
.sized {
height: 200px;
width: 300px;
border: 1px solid black;
padding: 10px;
}
.positioned {
top: 0;
left: 0;
}
</style>
</head>
<body unresolved>
<core-overlay class="sized" id="basic">
Sized Overlay
</core-overlay>
<core-overlay class="sized positioned" id="overlay">
Positioned Overlay
</core-overlay>
<template>
<div>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</div>
</template>
<script>
document.addEventListener('polymer-ready', function() {
// setup
var basic = document.querySelector('#basic');
var overlay = document.querySelector('#overlay');
var template = document.querySelector('template');
function testWhenOpen(element, test, next) {
var l1 = function() {
test();
element.async(function() {
element.opened = false;
}, 1);
};
var l2 = function() {
element.removeEventListener('core-overlay-open-completed', l1);
element.removeEventListener('core-overlay-close-completed', l2);
next();
};
element.addEventListener('core-overlay-open-completed', l1);
element.addEventListener('core-overlay-close-completed', l2);
element.opened = true;
}
asyncSeries([
// centered overlay
function(next) {
testWhenOpen(basic, function() {
var rect = basic.getBoundingClientRect();
chai.assert.ok(Math.abs(rect.left - (window.innerWidth - rect.right)) < 5, 'overlay centered horizontally');
chai.assert.ok(Math.abs(rect.top - (window.innerHeight - rect.bottom)) < 5, 'overlay centered vertically');
}, next);
},
// does not retain positioning when centered and re-opened
function(next) {
var listener = function(e) {
var dimensions = e.target.dimensions;
chai.assert.equal(dimensions.position.h, undefined);
chai.assert.equal(dimensions.position.v, undefined);
};
basic.addEventListener('core-overlay-open-completed', listener, false);
testWhenOpen(basic, function() {
var rect = basic.getBoundingClientRect();
chai.assert.ok(Math.abs(rect.left - (window.innerWidth - rect.right)) < 5, 'overlay centered horizontally');
chai.assert.ok(Math.abs(rect.top - (window.innerHeight - rect.bottom)) < 5, 'overlay centered vertically');
basic.removeEventListener('core-overlay-open-completed', listener, false);
}, next);
},
// css positioned overlay
function(next) {
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.equal(rect.left, 0, 'positions via css');
chai.assert.equal(rect.top, 0, 'positions via css');
}, next);
},
// manual positioned overlay
function(next) {
overlay.style.left = overlay.style.top = 'auto';
overlay.style.right = '0px';
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.equal(rect.right, window.innerWidth, 'positioned manually');
chai.assert.ok(Math.abs(rect.top - (window.innerHeight - rect.bottom)) < 5, 'overlay centered vertically');
}, next);
},
// overflow, position top, left
function(next) {
overlay.style.left = overlay.style.top = '0px';
overlay.style.right = 'auto';
overlay.style.width = overlay.style.height = 'auto';
for (var i=0; i<20; i++) {
overlay.appendChild(template.content.cloneNode(true));
}
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
// overflow, position, bottom, right
function(next) {
overlay.style.right = overlay.style.bottom = '0px';
overlay.style.left = overlay.style.top = 'auto';
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
// overflow, unpositioned
function(next) {
overlay.style.right = overlay.style.bottom = 'auto';
overlay.style.left = overlay.style.top = 'auto';
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
// overflow, unpositioned, layered
function(next) {
overlay.layered = true;
testWhenOpen(overlay, function() {
var rect = overlay.getBoundingClientRect();
chai.assert.ok(window.innerWidth >= rect.right, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom, 'overlay constrained to window size');
}, next);
},
], done);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,130 @@
<!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-overlay</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../../webcomponentsjs/webcomponents.js"></script>
<script src="../../../polymer-test-tools/chai/chai.js"></script>
<script src="../../../polymer-test-tools/htmltest.js"></script>
<link rel="import" href="../../../core-transition/core-transition-css.html">
<link rel="import" href="../../core-overlay.html">
<style>
core-overlay {
width: 300px;
border: 1px solid black;
margin: 10px;
overflow: auto !important;
}
#content {
overflow: auto;
}
</style>
</head>
<body fullbleed unresolved>
<template is="auto-binding">
<core-overlay id="simple">
<div>Lots of Content that might overflow the overlay!</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</core-overlay>
<core-overlay id="sectioned" vertical layout sizingTarget="{{$.content}}">
<header>Stuff on top</header>
<section id="content">
<div>Lots of Content that might overflow the overlay!</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</section>
<footer>Stuff on bottom</footer>
</core-overlay>
</template>
<script>
addEventListener('template-bound', function(e) {
// setup
var simple = document.querySelector('#simple');
var sectioned = document.querySelector('#sectioned');
function testWhenOpen(element, test, next) {
var l1 = function() {
test();
element.async(function() {
element.opened = false;
}, null, 1);
};
var l2 = function() {
element.removeEventListener('core-overlay-open-completed', l1);
element.removeEventListener('core-overlay-close-completed', l2);
next();
};
element.addEventListener('core-overlay-open-completed', l1);
element.addEventListener('core-overlay-close-completed', l2);
element.opened = true;
}
asyncSeries([
// scrolling overlay does not overflow
function(next) {
testWhenOpen(simple, function() {
var rect = simple.getBoundingClientRect();
chai.assert.ok(0 < rect.top + 10, 'overlay constrained to window size');
chai.assert.ok(0 < rect.left + 10, 'overlay constrained to window size');
chai.assert.ok(window.innerWidth >= rect.right + 10, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom + 10, 'overlay constrained to window size');
}, next);
},
// scrolling overlay does not overflow
function(next) {
testWhenOpen(sectioned, function() {
var rect = sectioned.getBoundingClientRect();
chai.assert.ok(0 < rect.top + 10, 'overlay constrained to window size');
chai.assert.ok(0 < rect.left + 10, 'overlay constrained to window size');
chai.assert.ok(window.innerWidth >= rect.right + 10, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom + 10, 'overlay constrained to window size');
}, next);
},
// positioned scrolling overlay does not overflow
function(next) {
sectioned.style.top = sectioned.style.right = '';
sectioned.style.left = '300px';
sectioned.style.bottom = '200px'
testWhenOpen(sectioned, function() {
var rect = sectioned.getBoundingClientRect();
chai.assert.ok(0 < rect.top + 10, 'overlay constrained to window size');
chai.assert.ok(0 < rect.left + 10, 'overlay constrained to window size');
chai.assert.ok(window.innerWidth >= rect.right + 10, 'overlay constrained to window size');
chai.assert.ok(window.innerHeight >= rect.bottom + 10, 'overlay constrained to window size');
}, next);
}
], done);
});
</script>
</body>
</html>
</html>

View File

@@ -0,0 +1,6 @@
htmlSuite('core-overlay', function() {
htmlTest('html/core-overlay-basic.html');
htmlTest('html/core-overlay-positioning.html');
htmlTest('html/core-overlay-positioning-margin.html');
htmlTest('html/core-overlay-scroll.html');
});

View File

@@ -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>

View File

@@ -0,0 +1,6 @@
{
"tools": ["chai", "mocha-tdd"],
"tests": [
"js/htmltests.js"
]
}