added tests with paper-slider
This commit is contained in:
20
bower_components/core-input/.bower.json
vendored
Normal file
20
bower_components/core-input/.bower.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "core-input",
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-component-tester": "Polymer/web-component-tester#^1.1.4"
|
||||
},
|
||||
"version": "0.5.2",
|
||||
"homepage": "https://github.com/Polymer/core-input",
|
||||
"_release": "0.5.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.5.2",
|
||||
"commit": "d6d72e5fc2bef134b937562e13a728c6a0241579"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/core-input.git",
|
||||
"_target": "^0.5.0",
|
||||
"_originalSource": "Polymer/core-input"
|
||||
}
|
||||
2
bower_components/core-input/README.md
vendored
Normal file
2
bower_components/core-input/README.md
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
core-input
|
||||
==========
|
||||
10
bower_components/core-input/bower.json
vendored
Normal file
10
bower_components/core-input/bower.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "core-input",
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-component-tester": "Polymer/web-component-tester#^1.1.4"
|
||||
},
|
||||
"version": "0.5.2"
|
||||
}
|
||||
41
bower_components/core-input/core-input.css
vendored
Normal file
41
bower_components/core-input/core-input.css
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* @license
|
||||
* 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
|
||||
*/
|
||||
|
||||
:host {
|
||||
display: inline-block;
|
||||
text-align: inherit;
|
||||
position: relative;
|
||||
width: 20em;
|
||||
}
|
||||
|
||||
:host:hover {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
||||
textarea[rows=fit] {
|
||||
height: 100%;
|
||||
}
|
||||
148
bower_components/core-input/core-input.html
vendored
Normal file
148
bower_components/core-input/core-input.html
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<!--
|
||||
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
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
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
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
||||
`core-input` is an unstyled single-line input field. It extends the native
|
||||
`input` element.
|
||||
|
||||
Example:
|
||||
|
||||
<input is="core-input">
|
||||
|
||||
The input's value is considered "committed" if the user hits the "enter" key
|
||||
or blurs the input after changing the value. The committed value is stored in
|
||||
the `committedValue` property.
|
||||
|
||||
If the input has `type = number`, this element will also prevent non-numeric characters
|
||||
from being typed into the text field.
|
||||
|
||||
Accessibility
|
||||
-------------
|
||||
|
||||
The following ARIA attributes are set automatically:
|
||||
|
||||
- `aria-label`: set to the `placeholder` attribute
|
||||
- `aria-disabled`: set if `disabled` is true
|
||||
|
||||
@group Polymer Core Elements
|
||||
@element core-input
|
||||
@extends input
|
||||
@homepage github.io
|
||||
-->
|
||||
<link href="../polymer/polymer.html" rel="import">
|
||||
|
||||
<style shim-shadowdom>
|
||||
/* FIXME consider theming */
|
||||
|
||||
html /deep/ input[is=core-input] {
|
||||
width: 20em;
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
outline: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<polymer-element name="core-input" extends="input">
|
||||
|
||||
<script>
|
||||
|
||||
Polymer('core-input', {
|
||||
|
||||
publish: {
|
||||
|
||||
/**
|
||||
* The "committed" value of the input, ie. the input value when the user
|
||||
* hits the "enter" key or blurs the input after changing the value. You
|
||||
* can bind to this value instead of listening for the "change" event.
|
||||
* Setting this property has no effect on the input value.
|
||||
*
|
||||
* @attribute committedValue
|
||||
* @type string
|
||||
* @default ''
|
||||
*/
|
||||
committedValue: '',
|
||||
|
||||
/**
|
||||
* Set to true to prevent invalid input from being entered.
|
||||
*
|
||||
* @attribute preventInvalidInput
|
||||
* @type boolean
|
||||
* @default false
|
||||
*/
|
||||
preventInvalidInput: false
|
||||
|
||||
},
|
||||
|
||||
previousValidInput: '',
|
||||
|
||||
eventDelegates: {
|
||||
input: 'inputAction',
|
||||
change: 'changeAction'
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
/* set ARIA attributes */
|
||||
this.disabledHandler();
|
||||
this.placeholderHandler();
|
||||
},
|
||||
|
||||
attributeChanged: function(attr, old) {
|
||||
if (this[attr + 'Handler']) {
|
||||
this[attr + 'Handler'](old);
|
||||
}
|
||||
},
|
||||
|
||||
disabledHandler: function() {
|
||||
if (this.disabled) {
|
||||
this.setAttribute('aria-disabled', '');
|
||||
} else {
|
||||
this.removeAttribute('aria-disabled');
|
||||
}
|
||||
},
|
||||
|
||||
placeholderHandler: function() {
|
||||
if (this.placeholder) {
|
||||
this.setAttribute('aria-label', this.placeholder);
|
||||
} else {
|
||||
this.removeAttribute('aria-label');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Commits the `value` to `committedValue`
|
||||
*
|
||||
* @method commit
|
||||
*/
|
||||
commit: function() {
|
||||
this.committedValue = this.value;
|
||||
},
|
||||
|
||||
changeAction: function() {
|
||||
this.commit();
|
||||
},
|
||||
|
||||
inputAction: function(e) {
|
||||
if (this.preventInvalidInput) {
|
||||
if (!e.target.validity.valid) {
|
||||
e.target.value = this.previousValidInput;
|
||||
} else {
|
||||
this.previousValidInput = e.target.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</polymer-element>
|
||||
62
bower_components/core-input/demo.html
vendored
Normal file
62
bower_components/core-input/demo.html
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<!--
|
||||
@license
|
||||
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
|
||||
-->
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
|
||||
<title>core-input</title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
|
||||
<link href="core-input.html" rel="import">
|
||||
|
||||
<style shim-shadowdom>
|
||||
body {
|
||||
font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
padding: 24px;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
section {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
section > div {
|
||||
padding: 14px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<template is="auto-binding">
|
||||
|
||||
<section>
|
||||
|
||||
<input is="core-input" placeholder="a single-line input" value="{{value1}}" committedValue="{{committedValue1}}">
|
||||
|
||||
<p>value: {{value1}}, committedValue: {{committedValue1}}</p>
|
||||
|
||||
<input is="core-input" type="number" preventInvalidInput placeholder="input type = number, preventInvalidInput" value="{{value2}}" committedValue="{{committedValue2}}">
|
||||
|
||||
<p>value: {{value2}}, committedValue: {{committedValue2}}</p>
|
||||
|
||||
</section>
|
||||
|
||||
</template>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
bower_components/core-input/index.html
vendored
Normal file
22
bower_components/core-input/index.html
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!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
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
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
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel="import" href="../core-component-page/core-component-page.html">
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<core-component-page></core-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
23
bower_components/core-input/metadata.html
vendored
Normal file
23
bower_components/core-input/metadata.html
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
@license
|
||||
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
|
||||
-->
|
||||
<x-meta id="core-input" label="Input" group="Core" isEditor>
|
||||
|
||||
<property name="value"></property>
|
||||
<property name="placeholder"></property>
|
||||
|
||||
<template>
|
||||
<input is="core-input" placeholder="type something..." style="padding: 15px;">
|
||||
</template>
|
||||
|
||||
<template id="imports">
|
||||
<link rel="import" href="core-input.html">
|
||||
</template>
|
||||
|
||||
</x-meta>
|
||||
55
bower_components/core-input/test/a11y.html
vendored
Normal file
55
bower_components/core-input/test/a11y.html
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<!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>core-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.html" rel="import">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<input id="input1" is="core-input" placeholder="label">
|
||||
<input id="input2" is="core-input" disabled>
|
||||
|
||||
<script>
|
||||
|
||||
var i1 = document.getElementById('input1');
|
||||
var i2 = document.getElementById('input2');
|
||||
|
||||
test('aria-label set to placeholder', function(done) {
|
||||
assert.strictEqual('label', i1.getAttribute('aria-label'));
|
||||
// test failing on polyfill due to https://github.com/Polymer/webcomponentsjs-dev/issues/13
|
||||
// i1.placeholder = 'new label';
|
||||
i1.setAttribute('placeholder', 'new label');
|
||||
flush(function() {
|
||||
assert.strictEqual(i1.getAttribute('aria-label'), 'new label');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('aria-disabled is set', function(done) {
|
||||
assert.ok(i2.hasAttribute('aria-disabled'));
|
||||
i2.removeAttribute('disabled');
|
||||
flush(function() {
|
||||
assert.ok(!i2.hasAttribute('aria-disabled'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
60
bower_components/core-input/test/basic.html
vendored
Normal file
60
bower_components/core-input/test/basic.html
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<!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>core-input basic 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.html" rel="import">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<input id="input1" is="core-input" pattern="[abc]*" preventInvalidInput>
|
||||
|
||||
<script>
|
||||
|
||||
var i1 = document.getElementById('input1');
|
||||
|
||||
function dispatchInputEvent(target) {
|
||||
var e = new Event('input', {
|
||||
bubbles: true
|
||||
});
|
||||
target.dispatchEvent(e);
|
||||
};
|
||||
|
||||
suite('preventInvalidInput', function() {
|
||||
|
||||
test('cannot enter invalid input', function() {
|
||||
i1.value = '123';
|
||||
dispatchInputEvent(i1);
|
||||
assert.ok(!i1.value);
|
||||
});
|
||||
|
||||
test('preserves valid input after entering invalid input', function() {
|
||||
var value = 'abc';
|
||||
i1.value = value;
|
||||
dispatchInputEvent(i1);
|
||||
assert.strictEqual(value, i1.value);
|
||||
i1.value = value + '123';
|
||||
dispatchInputEvent(i1);
|
||||
assert.strictEqual(value, i1.value);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
bower_components/core-input/test/index.html
vendored
Normal file
25
bower_components/core-input/test/index.html
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<!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>core-input tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'basic.html',
|
||||
'a11y.html'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user