added tests with paper-slider
This commit is contained in:
51
bower_components/paper-input/test/a11y.html
vendored
Normal file
51
bower_components/paper-input/test/a11y.html
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<!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>
|
||||
<meta charset="UTF-8">
|
||||
<title>paper-input a11y tests</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link href="../../core-input/core-input.html" rel="import">
|
||||
|
||||
<link href="../paper-input-decorator.html" rel="import">
|
||||
<link href="../paper-autogrow-textarea.html" rel="import">
|
||||
|
||||
<style>
|
||||
paper-input-decorator {
|
||||
width: 400px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-input-decorator id="decorator1" label="input">
|
||||
<input id="input1" is="core-input">
|
||||
</paper-input-decorator>
|
||||
|
||||
<br>
|
||||
|
||||
<script>
|
||||
|
||||
var d1 = document.getElementById('decorator1');
|
||||
var i1 = document.getElementById('input1');
|
||||
|
||||
test('aria-label set on input', function() {
|
||||
assert.strictEqual(i1.getAttribute('aria-label'), d1.label);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
132
bower_components/paper-input/test/autogrow.html
vendored
Normal file
132
bower_components/paper-input/test/autogrow.html
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
<!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>
|
||||
<meta charset="UTF-8">
|
||||
<title>paper-autogrow-textarea</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link href="../paper-autogrow-textarea.html" rel="import">
|
||||
|
||||
<style>
|
||||
paper-autogrow-textarea {
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
textarea {
|
||||
background-color: yellow;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-autogrow-textarea id="autogrow1">
|
||||
<textarea id="textarea1"></textarea>
|
||||
</paper-autogrow-textarea>
|
||||
|
||||
<paper-autogrow-textarea id="autogrow2" rows="2" maxRows="4">
|
||||
<textarea id="textarea2"></textarea>
|
||||
</paper-autogrow-textarea>
|
||||
|
||||
<script>
|
||||
|
||||
var a1 = document.getElementById('autogrow1');
|
||||
var t1 = document.getElementById('textarea1');
|
||||
|
||||
function dispatchInputEvent(target) {
|
||||
var e = new Event('input', {
|
||||
bubbles: true
|
||||
});
|
||||
target.dispatchEvent(e);
|
||||
};
|
||||
|
||||
function between(val, val1, val2) {
|
||||
return assert.ok(val > val1 && val < val2);
|
||||
}
|
||||
|
||||
suite('basic', function() {
|
||||
|
||||
teardown(function(done) {
|
||||
t1.value = '';
|
||||
dispatchInputEvent(t1);
|
||||
a1.rows = 1;
|
||||
a1.maxRows = 0;
|
||||
|
||||
flush(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('empty input has height', function() {
|
||||
assert.ok(a1.offsetHeight > 0);
|
||||
});
|
||||
|
||||
test('accepts number input', function() {
|
||||
t1.value = 1;
|
||||
dispatchInputEvent(t1);
|
||||
// make sure we didn't crash
|
||||
});
|
||||
|
||||
test('grows with more rows of input', function(done) {
|
||||
t1.value = 'foo\nbar';
|
||||
dispatchInputEvent(t1);
|
||||
|
||||
var h1 = a1.offsetHeight;
|
||||
|
||||
t1.value = 'foo\nbar\nbaz';
|
||||
dispatchInputEvent(t1);
|
||||
|
||||
flush(function() {
|
||||
var h2 = a1.offsetHeight;
|
||||
assert.ok(h2 > h1);
|
||||
assert.deepEqual(a1.getBoundingClientRect(), t1.getBoundingClientRect());
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('honors the rows attribute', function(done) {
|
||||
var h1 = a1.offsetHeight;
|
||||
a1.rows = 2;
|
||||
|
||||
flush(function() {
|
||||
var h2 = a1.offsetHeight;
|
||||
between(h2, h1, 3 * h1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('honors the maxRows attribute', function(done) {
|
||||
var h1 = a1.offsetHeight;
|
||||
a1.maxRows = 2;
|
||||
|
||||
t1.value = 'foo\nbar\nbaz\nzot';
|
||||
dispatchInputEvent(t1);
|
||||
|
||||
flush(function() {
|
||||
var h2 = a1.offsetHeight;
|
||||
assert.ok(h2 < 3 * h1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('mirror text is visibility:hidden', function() {
|
||||
assert.equal(getComputedStyle(a1.$.mirror).visibility, 'hidden');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
150
bower_components/paper-input/test/decorator.html
vendored
Normal file
150
bower_components/paper-input/test/decorator.html
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
<!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>
|
||||
<meta charset="UTF-8">
|
||||
<title>paper-input-decorator tests</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../polymer-gestures/test/js/fake.js"></script>
|
||||
|
||||
<link href="../../core-input/core-input.html" rel="import">
|
||||
|
||||
<link href="../paper-input-decorator.html" rel="import">
|
||||
<link href="../paper-autogrow-textarea.html" rel="import">
|
||||
|
||||
<style>
|
||||
paper-input-decorator {
|
||||
width: 400px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-input-decorator id="decorator1" label="input">
|
||||
<input id="input1" is="core-input">
|
||||
</paper-input-decorator>
|
||||
|
||||
<br>
|
||||
|
||||
<paper-input-decorator id="decorator2" label="input">
|
||||
</paper-input-decorator>
|
||||
|
||||
<br>
|
||||
|
||||
<paper-input-decorator id="decorator3" label="input" floatingLabel>
|
||||
<input id="input3" is="core-input">
|
||||
</paper-input-decorator>
|
||||
|
||||
<paper-input-decorator id="decorator4" label="input" floatingLabel isInvalid error="error message">
|
||||
<input id="input4" is="core-input" value="something">
|
||||
</paper-input-decorator>
|
||||
|
||||
<br>
|
||||
|
||||
<paper-input-decorator id="decorator5" label="input" labelVisible="false">
|
||||
<input>
|
||||
</paper-input-decorator>
|
||||
|
||||
<br>
|
||||
|
||||
<script>
|
||||
|
||||
var fake = new Fake();
|
||||
|
||||
var d1 = document.getElementById('decorator1');
|
||||
var i1 = document.getElementById('input1');
|
||||
var d2 = document.getElementById('decorator2');
|
||||
var d3 = document.getElementById('decorator3');
|
||||
var i3 = document.getElementById('input3');
|
||||
var d4 = document.getElementById('decorator4');
|
||||
var i4 = document.getElementById('input4');
|
||||
var d5 = document.getElementById('decorator5');
|
||||
|
||||
function reset(d, i) {
|
||||
d.labelVisible = null;
|
||||
i.value = null;
|
||||
d.updateLabelVisibility(i.value);
|
||||
}
|
||||
|
||||
suite('basic', function() {
|
||||
|
||||
teardown(function() {
|
||||
reset(d1, i1);
|
||||
reset(d3, i3);
|
||||
});
|
||||
|
||||
test('label is invisible if value is not null', function() {
|
||||
assert.ok(d1._labelVisible);
|
||||
i1.value = 'foobar';
|
||||
d1.updateLabelVisibility(i1.value);
|
||||
assert.ok(!d1._labelVisible);
|
||||
});
|
||||
|
||||
test('label is invisible if floating label and focused', function(done) {
|
||||
assert.ok(d3._labelVisible);
|
||||
d3.focusAction();
|
||||
flush(function() {
|
||||
assert.ok(!d3._labelVisible);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('label is invisible if value = 0', function() {
|
||||
assert.ok(d1._labelVisible);
|
||||
i1.value = 0;
|
||||
d1.updateLabelVisibility(i1.value);
|
||||
assert.ok(!d1._labelVisible);
|
||||
});
|
||||
|
||||
test('labelVisible overrides label visibility', function() {
|
||||
d1.labelVisible = false;
|
||||
assert.ok(!i1.value);
|
||||
assert.ok(!d1._labelVisible);
|
||||
});
|
||||
|
||||
test('labelVisible works in an attribute', function() {
|
||||
assert.ok(!d5._labelVisible);
|
||||
});
|
||||
|
||||
test('can create inputs lazily', function() {
|
||||
var input = document.createElement('input');
|
||||
input.value = 'foobar';
|
||||
d2.appendChild(input);
|
||||
assert.ok(!d2._labelVisible);
|
||||
});
|
||||
|
||||
test('tapping on floating label focuses input', function(done) {
|
||||
i3.value = 'foobar';
|
||||
flush(function() {
|
||||
assert.ok(!d3._labelVisible);
|
||||
fake.downOnNode(d1.shadowRoot.querySelector('.floated-label'));
|
||||
flush(function() {
|
||||
assert.strictEqual(window.ShadowDOMPolyfill ? wrap(document.activeElement) : document.activeElement, i1);
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
test('floating label and the error message are the same color', function() {
|
||||
var s1 = getComputedStyle(d4.$.floatedLabelText);
|
||||
var s2 = getComputedStyle(d4.shadowRoot.querySelector('.error-text'));
|
||||
assert.strictEqual(s1.color, s2.color);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
26
bower_components/paper-input/test/index.html
vendored
Normal file
26
bower_components/paper-input/test/index.html
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<!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>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'a11y.html',
|
||||
'autogrow.html',
|
||||
'decorator.html'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user