update guide
This commit is contained in:
parent
7fbb1924d0
commit
9bbb9ecfb9
17 changed files with 291 additions and 56 deletions
30
dashboard-ui/bower_components/iron-validatable-behavior/test/cats-only.html
vendored
Normal file
30
dashboard-ui/bower_components/iron-validatable-behavior/test/cats-only.html
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 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
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../iron-validator-behavior/iron-validator-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
Polymer({
|
||||
|
||||
is: 'cats-only',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronValidatorBehavior
|
||||
],
|
||||
|
||||
validate: function(value) {
|
||||
return value === 'cats';
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
30
dashboard-ui/bower_components/iron-validatable-behavior/test/dogs-only.html
vendored
Normal file
30
dashboard-ui/bower_components/iron-validatable-behavior/test/dogs-only.html
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2016 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
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../iron-validator-behavior/iron-validator-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
Polymer({
|
||||
|
||||
is: 'dogs-only',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronValidatorBehavior
|
||||
],
|
||||
|
||||
validate: function(value) {
|
||||
return value === 'dogs';
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,5 +1,4 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
<!DOCTYPE html><!--
|
||||
@license
|
||||
Copyright (c) 2015 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
|
||||
|
@ -7,11 +6,9 @@ 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>
|
||||
--><html><head>
|
||||
|
||||
<title>paper-validatable-behavior tests</title>
|
||||
<title>iron-validatable-behavior tests</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
@ -23,13 +20,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<body>
|
||||
|
||||
<script>
|
||||
|
||||
/* no tests */
|
||||
WCT.loadSuites([
|
||||
'iron-validatable-behavior.html'
|
||||
'iron-validatable-behavior.html',
|
||||
'iron-validatable-behavior.html?dom=shadow'
|
||||
]);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
</body></html>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 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
|
||||
|
@ -23,6 +24,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="test-validatable.html">
|
||||
<link rel="import" href="cats-only.html">
|
||||
<link rel="import" href="dogs-only.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -33,6 +36,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="validators">
|
||||
<template>
|
||||
<cats-only></cats-only>
|
||||
<dogs-only></dogs-only>
|
||||
<test-validatable></test-validatable>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
|
||||
suite('basic', function() {
|
||||
|
@ -51,6 +62,25 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.isTrue(valid);
|
||||
});
|
||||
|
||||
test('changing the validator works', function() {
|
||||
var node = fixture('validators');
|
||||
var input = node[2];
|
||||
|
||||
// Initially there's no validator, so everything is valid.
|
||||
assert.isTrue(input.validate(''));
|
||||
assert.isTrue(input.validate('cats'));
|
||||
|
||||
// Only valid if the value is 'cats'.
|
||||
input.validator = 'cats-only';
|
||||
assert.isFalse(input.validate('ca'));
|
||||
assert.isTrue(input.validate('cats'));
|
||||
|
||||
// Only valid if the value is 'dogs'.
|
||||
input.validator = 'dogs-only';
|
||||
assert.isFalse(input.validate('cats'));
|
||||
assert.isTrue(input.validate('dogs'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue