polymer-gold-rails 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +36 -0
- data/Rakefile +1 -0
- data/app/assets/components/gold-cc-cvc-input/README.md +24 -0
- data/app/assets/components/gold-cc-cvc-input/bower.json +39 -0
- data/app/assets/components/gold-cc-cvc-input/cvc_hint.png +0 -0
- data/app/assets/components/gold-cc-cvc-input/cvc_hint_amex.png +0 -0
- data/app/assets/components/gold-cc-cvc-input/demo/index.html +54 -0
- data/app/assets/components/gold-cc-cvc-input/gold-cc-cvc-input.html +195 -0
- data/app/assets/components/gold-cc-cvc-input/hero.svg +36 -0
- data/app/assets/components/gold-cc-cvc-input/index.html +26 -0
- data/app/assets/components/gold-cc-cvc-input/test/basic.html +125 -0
- data/app/assets/components/gold-cc-cvc-input/test/index.html +25 -0
- data/app/assets/components/gold-cc-expiration-input/README.md +10 -0
- data/app/assets/components/gold-cc-expiration-input/bower.json +40 -0
- data/app/assets/components/gold-cc-expiration-input/date-input.html +157 -0
- data/app/assets/components/gold-cc-expiration-input/date-validator.html +38 -0
- data/app/assets/components/gold-cc-expiration-input/demo/index.html +53 -0
- data/app/assets/components/gold-cc-expiration-input/gold-cc-expiration-input.html +131 -0
- data/app/assets/components/gold-cc-expiration-input/hero.svg +58 -0
- data/app/assets/components/gold-cc-expiration-input/index.html +28 -0
- data/app/assets/components/gold-cc-expiration-input/test/basic.html +126 -0
- data/app/assets/components/gold-cc-expiration-input/test/index.html +25 -0
- data/app/assets/components/gold-cc-input/README.md +9 -0
- data/app/assets/components/gold-cc-input/bower.json +39 -0
- data/app/assets/components/gold-cc-input/cc-validator.js +192 -0
- data/app/assets/components/gold-cc-input/demo/index.html +48 -0
- data/app/assets/components/gold-cc-input/gold-cc-input.html +215 -0
- data/app/assets/components/gold-cc-input/hero.svg +52 -0
- data/app/assets/components/gold-cc-input/images/amex.png +0 -0
- data/app/assets/components/gold-cc-input/images/diners_club.png +0 -0
- data/app/assets/components/gold-cc-input/images/discover.png +0 -0
- data/app/assets/components/gold-cc-input/images/jcb.png +0 -0
- data/app/assets/components/gold-cc-input/images/mastercard.png +0 -0
- data/app/assets/components/gold-cc-input/images/visa.png +0 -0
- data/app/assets/components/gold-cc-input/index.html +28 -0
- data/app/assets/components/gold-cc-input/test/basic.html +136 -0
- data/app/assets/components/gold-cc-input/test/index.html +25 -0
- data/app/assets/components/gold-elements/README.md +12 -0
- data/app/assets/components/gold-elements/bower.json +42 -0
- data/app/assets/components/gold-elements/demo/complex-form.html +127 -0
- data/app/assets/components/gold-elements/demo/index.html +94 -0
- data/app/assets/components/gold-elements/demo/item-card.html +59 -0
- data/app/assets/components/gold-elements/demo/simple-form.css +55 -0
- data/app/assets/components/gold-elements/demo/simple-form.html +93 -0
- data/app/assets/components/gold-elements/screenshot.png +0 -0
- data/app/assets/components/gold-email-input/README.md +8 -0
- data/app/assets/components/gold-email-input/bower.json +40 -0
- data/app/assets/components/gold-email-input/demo/index.html +46 -0
- data/app/assets/components/gold-email-input/email-validator.html +31 -0
- data/app/assets/components/gold-email-input/gold-email-input.html +108 -0
- data/app/assets/components/gold-email-input/hero.svg +59 -0
- data/app/assets/components/gold-email-input/index.html +28 -0
- data/app/assets/components/gold-email-input/test/basic.html +97 -0
- data/app/assets/components/gold-email-input/test/index.html +25 -0
- data/app/assets/components/gold-phone-input/README.md +13 -0
- data/app/assets/components/gold-phone-input/bower.json +39 -0
- data/app/assets/components/gold-phone-input/demo/index.html +53 -0
- data/app/assets/components/gold-phone-input/gold-phone-input.html +197 -0
- data/app/assets/components/gold-phone-input/hero.svg +63 -0
- data/app/assets/components/gold-phone-input/index.html +28 -0
- data/app/assets/components/gold-phone-input/test/basic.html +117 -0
- data/app/assets/components/gold-phone-input/test/index.html +25 -0
- data/app/assets/components/gold-zip-input/README.md +8 -0
- data/app/assets/components/gold-zip-input/bower.json +40 -0
- data/app/assets/components/gold-zip-input/demo/index.html +54 -0
- data/app/assets/components/gold-zip-input/gold-zip-input.html +113 -0
- data/app/assets/components/gold-zip-input/hero.svg +43 -0
- data/app/assets/components/gold-zip-input/index.html +28 -0
- data/app/assets/components/gold-zip-input/test/basic.html +116 -0
- data/app/assets/components/gold-zip-input/test/index.html +25 -0
- data/app/assets/components/gold-zip-input/zip-validator.html +32 -0
- data/app/assets/components/iron-autogrow-textarea/README.md +24 -0
- data/app/assets/components/iron-autogrow-textarea/bower.json +37 -0
- data/app/assets/components/iron-autogrow-textarea/demo/index.html +81 -0
- data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
- data/app/assets/components/iron-autogrow-textarea/index.html +30 -0
- data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
- data/app/assets/components/iron-autogrow-textarea/test/basic.html +94 -0
- data/app/assets/components/iron-autogrow-textarea/test/index.html +25 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-form-element-behavior/README.md +2 -0
- data/app/assets/components/iron-form-element-behavior/bower.json +27 -0
- data/app/assets/components/iron-form-element-behavior/demo/index.html +53 -0
- data/app/assets/components/iron-form-element-behavior/demo/simple-element.html +27 -0
- data/app/assets/components/iron-form-element-behavior/demo/simple-form.html +42 -0
- data/app/assets/components/iron-form-element-behavior/index.html +30 -0
- data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
- data/app/assets/components/iron-icon/README.md +56 -0
- data/app/assets/components/iron-icon/bower.json +29 -0
- data/app/assets/components/iron-icon/demo/index.html +28 -0
- data/app/assets/components/iron-icon/demo/location.png +0 -0
- data/app/assets/components/iron-icon/hero.svg +19 -0
- data/app/assets/components/iron-icon/index.html +26 -0
- data/app/assets/components/iron-icon/iron-icon.html +187 -0
- data/app/assets/components/iron-icon/test/index.html +31 -0
- data/app/assets/components/iron-icon/test/iron-icon.html +120 -0
- data/app/assets/components/iron-input/README.md +16 -0
- data/app/assets/components/iron-input/bower.json +36 -0
- data/app/assets/components/iron-input/demo/index.html +87 -0
- data/app/assets/components/iron-input/hero.svg +19 -0
- data/app/assets/components/iron-input/index.html +30 -0
- data/app/assets/components/iron-input/iron-input.html +235 -0
- data/app/assets/components/iron-input/test/index.html +24 -0
- data/app/assets/components/iron-input/test/iron-input.html +139 -0
- data/app/assets/components/iron-input/test/letters-only.html +30 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-validatable-behavior/README.md +3 -0
- data/app/assets/components/iron-validatable-behavior/bower.json +35 -0
- data/app/assets/components/iron-validatable-behavior/demo/cats-only.html +46 -0
- data/app/assets/components/iron-validatable-behavior/demo/index.html +71 -0
- data/app/assets/components/iron-validatable-behavior/demo/validatable-input.html +46 -0
- data/app/assets/components/iron-validatable-behavior/index.html +30 -0
- data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +101 -0
- data/app/assets/components/iron-validatable-behavior/test/index.html +35 -0
- data/app/assets/components/iron-validatable-behavior/test/iron-validatable-behavior.html +52 -0
- data/app/assets/components/iron-validatable-behavior/test/test-validatable.html +28 -0
- data/app/assets/components/iron-validator-behavior/README.md +4 -0
- data/app/assets/components/iron-validator-behavior/bower.json +34 -0
- data/app/assets/components/iron-validator-behavior/demo/cats-only.html +46 -0
- data/app/assets/components/iron-validator-behavior/demo/index.html +144 -0
- data/app/assets/components/iron-validator-behavior/index.html +30 -0
- data/app/assets/components/iron-validator-behavior/iron-validator-behavior.html +61 -0
- data/app/assets/components/iron-validator-behavior/test/index.html +34 -0
- data/app/assets/components/iron-validator-behavior/test/iron-validator-behavior.html +47 -0
- data/app/assets/components/iron-validator-behavior/test/simple-validator.html +26 -0
- data/app/assets/components/paper-input/README.md +5 -0
- data/app/assets/components/paper-input/all-imports.html +12 -0
- data/app/assets/components/paper-input/bower.json +44 -0
- data/app/assets/components/paper-input/demo/index.html +96 -0
- data/app/assets/components/paper-input/demo/ssn-input.html +94 -0
- data/app/assets/components/paper-input/demo/ssn-validator.html +31 -0
- data/app/assets/components/paper-input/hero.svg +19 -0
- data/app/assets/components/paper-input/index.html +28 -0
- data/app/assets/components/paper-input/paper-input-addon-behavior.html +47 -0
- data/app/assets/components/paper-input/paper-input-behavior.html +317 -0
- data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
- data/app/assets/components/paper-input/paper-input-container.html +495 -0
- data/app/assets/components/paper-input/paper-input-error.html +99 -0
- data/app/assets/components/paper-input/paper-input.html +126 -0
- data/app/assets/components/paper-input/paper-textarea.html +106 -0
- data/app/assets/components/paper-input/test/index.html +28 -0
- data/app/assets/components/paper-input/test/letters-only.html +30 -0
- data/app/assets/components/paper-input/test/paper-input-char-counter.html +112 -0
- data/app/assets/components/paper-input/test/paper-input-container.html +237 -0
- data/app/assets/components/paper-input/test/paper-input-error.html +60 -0
- data/app/assets/components/paper-input/test/paper-input.html +213 -0
- data/app/assets/components/paper-input/test/paper-textarea.html +169 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/README.md +125 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-gold-rails.rb +2 -0
- data/lib/polymer-gold-rails/enigne.rb +4 -0
- data/lib/polymer-gold-rails/version.rb +3 -0
- metadata +312 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
5
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
6
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
7
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
8
|
+
Code distributed by Google as part of the polymer project is also
|
9
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
10
|
+
-->
|
11
|
+
|
12
|
+
<html>
|
13
|
+
<head>
|
14
|
+
|
15
|
+
<title>iron-meta-basic</title>
|
16
|
+
<meta charset="utf-8">
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
18
|
+
|
19
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
20
|
+
<script src="../../web-component-tester/browser.js"></script>
|
21
|
+
|
22
|
+
<link rel="import" href="../iron-meta.html">
|
23
|
+
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
|
27
|
+
<iron-meta key="info" value="foo/bar"></iron-meta>
|
28
|
+
|
29
|
+
<script>
|
30
|
+
|
31
|
+
suite('basic', function() {
|
32
|
+
|
33
|
+
test('byKey', function() {
|
34
|
+
var meta = document.createElement('iron-meta');
|
35
|
+
assert.equal(meta.byKey('info'), 'foo/bar');
|
36
|
+
});
|
37
|
+
|
38
|
+
test('list', function() {
|
39
|
+
var meta = document.createElement('iron-meta');
|
40
|
+
assert.equal(meta.list.length, 1);
|
41
|
+
});
|
42
|
+
|
43
|
+
});
|
44
|
+
|
45
|
+
</script>
|
46
|
+
|
47
|
+
</body>
|
48
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
5
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
6
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
7
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
8
|
+
Code distributed by Google as part of the polymer project is also
|
9
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
10
|
+
-->
|
11
|
+
|
12
|
+
<html>
|
13
|
+
<head>
|
14
|
+
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<title>Tests</title>
|
17
|
+
<script src="../../web-component-tester/browser.js"></script>
|
18
|
+
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
|
22
|
+
<script>
|
23
|
+
WCT.loadSuites([
|
24
|
+
'basic.html',
|
25
|
+
'iron-meta.html'
|
26
|
+
]);
|
27
|
+
</script>
|
28
|
+
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,186 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
5
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
6
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
7
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
8
|
+
Code distributed by Google as part of the polymer project is also
|
9
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
10
|
+
-->
|
11
|
+
|
12
|
+
<html>
|
13
|
+
<head>
|
14
|
+
|
15
|
+
<title>iron-meta</title>
|
16
|
+
<meta charset="utf-8">
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
18
|
+
|
19
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
20
|
+
<script src="../../web-component-tester/browser.js"></script>
|
21
|
+
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
22
|
+
|
23
|
+
<link rel="import" href="../iron-meta.html">
|
24
|
+
<link rel="import" href="../../test-fixture/test-fixture.html">
|
25
|
+
|
26
|
+
</head>
|
27
|
+
<body>
|
28
|
+
|
29
|
+
<test-fixture id="TrivialMeta">
|
30
|
+
<template>
|
31
|
+
<iron-meta self key="info"></iron-meta>
|
32
|
+
</template>
|
33
|
+
</test-fixture>
|
34
|
+
|
35
|
+
<test-fixture id="ManyMetas">
|
36
|
+
<template>
|
37
|
+
<iron-meta self key="default1"></iron-meta>
|
38
|
+
<iron-meta self key="default2"></iron-meta>
|
39
|
+
<iron-meta self key="default3"></iron-meta>
|
40
|
+
</template>
|
41
|
+
</test-fixture>
|
42
|
+
|
43
|
+
<test-fixture id="DifferentTypedMetas">
|
44
|
+
<template>
|
45
|
+
<iron-meta self type="foo" key="foobarKey"></iron-meta>
|
46
|
+
<iron-meta self type="bar" key="foobarKey"></iron-meta>
|
47
|
+
<iron-meta self key="defaultKey"></iron-meta>
|
48
|
+
</template>
|
49
|
+
</test-fixture>
|
50
|
+
|
51
|
+
<test-fixture id="ClashingMetas">
|
52
|
+
<template>
|
53
|
+
<iron-meta self key="baz"></iron-meta>
|
54
|
+
<iron-meta self key="baz"></iron-meta>
|
55
|
+
</template>
|
56
|
+
</test-fixture>
|
57
|
+
|
58
|
+
<script>
|
59
|
+
suite('<iron-meta>', function () {
|
60
|
+
suite('basic behavior', function () {
|
61
|
+
var meta;
|
62
|
+
|
63
|
+
setup(function () {
|
64
|
+
meta = fixture('TrivialMeta');
|
65
|
+
});
|
66
|
+
|
67
|
+
teardown(function () {
|
68
|
+
meta.key = null;
|
69
|
+
});
|
70
|
+
|
71
|
+
test('uses itself as the default value', function () {
|
72
|
+
expect(meta.value).to.be.equal(meta);
|
73
|
+
});
|
74
|
+
|
75
|
+
test('can be assigned alternative values', function () {
|
76
|
+
meta.value = 'foobar';
|
77
|
+
|
78
|
+
expect(meta.list[0]).to.be.equal('foobar');
|
79
|
+
});
|
80
|
+
|
81
|
+
test('can access same-type meta values by key', function () {
|
82
|
+
expect(meta.byKey(meta.key)).to.be.equal(meta.value);
|
83
|
+
});
|
84
|
+
|
85
|
+
test('yields a list of same-type meta data', function () {
|
86
|
+
expect(meta.list).to.be.ok;
|
87
|
+
expect(meta.list.length).to.be.equal(1);
|
88
|
+
expect(meta.list[0]).to.be.equal(meta);
|
89
|
+
});
|
90
|
+
});
|
91
|
+
|
92
|
+
suite('many same-typed metas', function () {
|
93
|
+
var metas;
|
94
|
+
|
95
|
+
setup(function () {
|
96
|
+
metas = fixture('ManyMetas');
|
97
|
+
});
|
98
|
+
|
99
|
+
teardown(function () {
|
100
|
+
metas.forEach(function (meta) {
|
101
|
+
meta.key = null;
|
102
|
+
});
|
103
|
+
});
|
104
|
+
|
105
|
+
test('all cache all meta values', function () {
|
106
|
+
metas.forEach(function (meta, index) {
|
107
|
+
expect(meta.list.length).to.be.equal(metas.length);
|
108
|
+
expect(meta.list[index].value).to.be.equal(meta.value);
|
109
|
+
});
|
110
|
+
});
|
111
|
+
|
112
|
+
test('can be unregistered individually', function () {
|
113
|
+
metas[0].key = null;
|
114
|
+
|
115
|
+
expect(metas[0].list.length).to.be.equal(2);
|
116
|
+
expect(metas[0].list).to.be.deep.equal([metas[1], metas[2]])
|
117
|
+
});
|
118
|
+
|
119
|
+
test('can access each others value by key', function () {
|
120
|
+
expect(metas[0].byKey('default2')).to.be.equal(metas[1].value);
|
121
|
+
});
|
122
|
+
});
|
123
|
+
|
124
|
+
suite('different-typed metas', function () {
|
125
|
+
var metas;
|
126
|
+
|
127
|
+
setup(function () {
|
128
|
+
metas = fixture('DifferentTypedMetas');
|
129
|
+
});
|
130
|
+
|
131
|
+
teardown(function () {
|
132
|
+
metas.forEach(function (meta) {
|
133
|
+
meta.key = null;
|
134
|
+
});
|
135
|
+
});
|
136
|
+
|
137
|
+
test('cache their values separately', function () {
|
138
|
+
var fooMeta = metas[0];
|
139
|
+
var barMeta = metas[1];
|
140
|
+
|
141
|
+
expect(fooMeta.value).to.not.be.equal(barMeta.value);
|
142
|
+
expect(fooMeta.byKey('foobarKey')).to.be.equal(fooMeta.value);
|
143
|
+
expect(barMeta.byKey('foobarKey')).to.be.equal(barMeta.value);
|
144
|
+
});
|
145
|
+
|
146
|
+
test('cannot access values of other types', function () {
|
147
|
+
var defaultMeta = metas[2];
|
148
|
+
|
149
|
+
expect(defaultMeta.byKey('foobarKey')).to.be.equal(undefined);
|
150
|
+
});
|
151
|
+
|
152
|
+
test('only list values of their type', function () {
|
153
|
+
metas.forEach(function (meta) {
|
154
|
+
expect(meta.list.length).to.be.equal(1);
|
155
|
+
expect(meta.list[0]).to.be.equal(meta.value);
|
156
|
+
})
|
157
|
+
});
|
158
|
+
});
|
159
|
+
|
160
|
+
suite('metas with clashing keys', function () {
|
161
|
+
var metaPair;
|
162
|
+
|
163
|
+
setup(function () {
|
164
|
+
metaPair = fixture('ClashingMetas');
|
165
|
+
});
|
166
|
+
|
167
|
+
teardown(function () {
|
168
|
+
metaPair.forEach(function (meta) {
|
169
|
+
meta.key = null;
|
170
|
+
});
|
171
|
+
});
|
172
|
+
|
173
|
+
test('let the last value win registration against the key', function () {
|
174
|
+
var registeredValue = metaPair[0].byKey(metaPair[0].key);
|
175
|
+
var firstValue = metaPair[0].value;
|
176
|
+
var secondValue = metaPair[1].value;
|
177
|
+
|
178
|
+
expect(registeredValue).to.not.be.equal(firstValue);
|
179
|
+
expect(registeredValue).to.be.equal(secondValue);
|
180
|
+
});
|
181
|
+
});
|
182
|
+
});
|
183
|
+
</script>
|
184
|
+
|
185
|
+
</body>
|
186
|
+
</html>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"name": "iron-validatable-behavior",
|
3
|
+
"version": "1.0.2",
|
4
|
+
"description": "Provides a behavior for an element that validates user input",
|
5
|
+
"authors": "The Polymer Authors",
|
6
|
+
"keywords": [
|
7
|
+
"web-components",
|
8
|
+
"polymer",
|
9
|
+
"iron",
|
10
|
+
"behavior"
|
11
|
+
],
|
12
|
+
"main": [
|
13
|
+
"iron-validatable-behavior.html"
|
14
|
+
],
|
15
|
+
"private": true,
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "git://github.com/PolymerElements/iron-validatable-behavior.git"
|
19
|
+
},
|
20
|
+
"license": "http://polymer.github.io/LICENSE.txt",
|
21
|
+
"homepage": "https://github.com/PolymerElements/iron-validatable-behavior",
|
22
|
+
"ignore": [],
|
23
|
+
"dependencies": {
|
24
|
+
"iron-meta": "PolymerElements/iron-meta#^1.0.0",
|
25
|
+
"polymer": "Polymer/polymer#^1.0.0"
|
26
|
+
},
|
27
|
+
"devDependencies": {
|
28
|
+
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
|
29
|
+
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
30
|
+
"iron-validator-behavior": "PolymerElements/iron-validator-behavior#^1.0.0",
|
31
|
+
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
32
|
+
"web-component-tester": "*",
|
33
|
+
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<!--
|
2
|
+
@license
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
Code distributed by Google as part of the polymer project is also
|
8
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
-->
|
10
|
+
|
11
|
+
<link rel="import" href="../../polymer/polymer.html">
|
12
|
+
<link rel="import" href="../../iron-validator-behavior/iron-validator-behavior.html">
|
13
|
+
|
14
|
+
<script>
|
15
|
+
|
16
|
+
Polymer({
|
17
|
+
|
18
|
+
is: 'cats-only',
|
19
|
+
|
20
|
+
behaviors: [
|
21
|
+
Polymer.IronValidatorBehavior
|
22
|
+
],
|
23
|
+
|
24
|
+
validateObject: function(obj) {
|
25
|
+
var valid = true;
|
26
|
+
for (key in obj) {
|
27
|
+
if (obj[key] !== 'cats') {
|
28
|
+
valid = false;
|
29
|
+
break;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
return valid;
|
33
|
+
},
|
34
|
+
|
35
|
+
validate: function(values) {
|
36
|
+
if (typeof values === 'object') {
|
37
|
+
return this.validateObject(values);
|
38
|
+
} else {
|
39
|
+
var value = Array.isArray(values) ? values.join('') : values;
|
40
|
+
return value.match(/^(c|ca|cat|cats)?$/) !== null;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
});
|
45
|
+
|
46
|
+
</script>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
5
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
6
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
7
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
8
|
+
Code distributed by Google as part of the polymer project is also
|
9
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
10
|
+
-->
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<meta charset="utf-8">
|
15
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
16
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
17
|
+
|
18
|
+
<title>iron-validatable-behavior demo</title>
|
19
|
+
|
20
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
21
|
+
|
22
|
+
<link rel="import" href="../../paper-styles/demo-pages.html">
|
23
|
+
<link rel="import" href="cats-only.html">
|
24
|
+
<link rel="import" href="validatable-input.html">
|
25
|
+
|
26
|
+
<style is="custom-style">
|
27
|
+
|
28
|
+
.valid {
|
29
|
+
color: var(--google-green-500);
|
30
|
+
}
|
31
|
+
|
32
|
+
.invalid {
|
33
|
+
color: var(--google-red-500);
|
34
|
+
}
|
35
|
+
|
36
|
+
</style>
|
37
|
+
|
38
|
+
</head>
|
39
|
+
<body>
|
40
|
+
<div class="vertical-section vertical-section-container centered">
|
41
|
+
<h1><iron-validatable-behavior></h1>
|
42
|
+
|
43
|
+
<template is="dom-bind">
|
44
|
+
|
45
|
+
<cats-only></cats-only>
|
46
|
+
|
47
|
+
<section>
|
48
|
+
|
49
|
+
<p>
|
50
|
+
only type <code>cats</code>:
|
51
|
+
|
52
|
+
<input is="validatable-input" invalid="{{invalid}}" validator="cats-only">
|
53
|
+
|
54
|
+
<span class="valid" hidden$="[[invalid]]">valid</span>
|
55
|
+
<span class="invalid" hidden$="[[!invalid]]">invalid</span>
|
56
|
+
</p>
|
57
|
+
|
58
|
+
</section>
|
59
|
+
|
60
|
+
</template>
|
61
|
+
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<script>
|
65
|
+
|
66
|
+
document.querySelector('template[is="dom-bind"]').invalid = false;
|
67
|
+
|
68
|
+
</script>
|
69
|
+
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<!--
|
2
|
+
@license
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
Code distributed by Google as part of the polymer project is also
|
8
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
-->
|
10
|
+
|
11
|
+
<link rel="import" href="../../polymer/polymer.html">
|
12
|
+
<link rel="import" href="../iron-validatable-behavior.html">
|
13
|
+
|
14
|
+
<script>
|
15
|
+
|
16
|
+
Polymer({
|
17
|
+
|
18
|
+
is: 'validatable-input',
|
19
|
+
|
20
|
+
extends: 'input',
|
21
|
+
|
22
|
+
properties: {
|
23
|
+
|
24
|
+
invalid: {
|
25
|
+
notify: true,
|
26
|
+
type: Boolean,
|
27
|
+
value: false
|
28
|
+
}
|
29
|
+
|
30
|
+
},
|
31
|
+
|
32
|
+
behaviors: [
|
33
|
+
Polymer.IronValidatableBehavior
|
34
|
+
],
|
35
|
+
|
36
|
+
listeners: {
|
37
|
+
'input': '_onInput'
|
38
|
+
},
|
39
|
+
|
40
|
+
_onInput: function(event) {
|
41
|
+
this.invalid = !this.validate(event.target.value);
|
42
|
+
}
|
43
|
+
|
44
|
+
});
|
45
|
+
|
46
|
+
</script>
|