Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: polymer_1.0.4/bower_components/iron-localstorage/test/value-binding.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.g ithub.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/CONTRI BUTORS.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/PATEN TS.txt
10 -->
11 <html>
12 <head>
13 <meta charset="UTF-8">
14 <title>iron-localstorage-value-binding</title>
15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0">
16
17 <script src="../../webcomponentsjs/webcomponents.js"></script>
18 <script src="../../web-component-tester/browser.js"></script>
19 <script src="../../test-fixture/test-fixture-mocha.js"></script>
20
21 <link rel="import" href="../../test-fixture/test-fixture.html">
22 <link rel="import" href="../iron-localstorage.html">
23
24 </head>
25 <body>
26
27 <dom-module id="x-foo">
28 <template>
29 <div>{{value.foo}}</div>
30 </template>
31 </dom-module>
32
33 <dom-module id="x-test">
34 <template>
35 <x-foo value="{{value}}"></x-foo>
36 <iron-localstorage id="localstorage" name="iron-localstorage-test" value=" {{value}}"></iron-localstorage>
37 </template>
38 </dom-module>
39
40 <x-test></x-test>
41
42 <script>
43
44 window.localStorage.setItem('iron-localstorage-test', '{"foo":"bar"}');
45 var xtest;
46
47 suite('basic', function() {
48
49 suiteSetup(function() {
50 Polymer({
51 is: 'x-foo',
52 properties: {
53 'value': {
54 type: Object,
55 notify: true
56 }
57 }
58 });
59 Polymer({
60 is: 'x-test',
61 properties: {
62 'value': {
63 type: Object,
64 notify: true
65 }
66 }
67 });
68 window.localStorage.setItem('iron-localstorage-test', '{"foo":"bar"}');
69 xtest = document.querySelector('x-test');
70 xtest.$.localstorage.reload();
71 });
72
73 suiteTeardown(function() {
74 window.localStorage.removeItem('iron-localstorage-test');
75 });
76
77 test('initial value', function() {
78 assert.isNotNull(xtest.value);
79 assert.equal(xtest.value.foo, 'bar');
80 });
81
82 test('set value', function() {
83 var newValue = {'foo': 'zot'};
84 xtest.value = newValue;
85 xtest.$.localstorage.flushDebouncer('save');
86 var v = window.localStorage.getItem(xtest.$.localstorage.name);
87 v = JSON.parse(v);
88 assert.equal(v.foo, newValue.foo);
89 });
90
91 test('save', function() {
92 xtest.value.foo = 'quux';
93 xtest.$.localstorage.save();
94 var v = window.localStorage.getItem(xtest.$.localstorage.name);
95 v = JSON.parse(v);
96 assert.equal(v.foo, 'quux');
97 });
98
99 });
100
101 </script>
102
103 </body>
104 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698