| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 | 5 |
| 6 --> | 6 --> |
| 7 <!DOCTYPE html> | 7 <!DOCTYPE html> |
| 8 <html> | 8 <html> |
| 9 <head> | 9 <head> |
| 10 <title>pageable-data Demo</title> | 10 <title>pageable-data Demo</title> |
| 11 <meta charset="utf-8"> | 11 <meta charset="utf-8"> |
| 12 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 12 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 13 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> | 13 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> |
| 14 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> | 14 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> |
| 15 <script src="../../../node_modules/skia-common-js/common.js"></script> | 15 <script src="../../../node_modules/skia-common-js/common.js"></script> |
| 16 <script src="/res/js/common.js"></script> | 16 <script src="/res/js/common.js"></script> |
| 17 <script src="/res/js/alias.js"></script> | 17 <script src="/res/js/alias.js"></script> |
| 18 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script> | 18 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script> |
| 19 | 19 |
| 20 | 20 |
| 21 <script type="text/javascript" charset="utf-8"> | 21 <script type="text/javascript" charset="utf-8"> |
| 22 sinon.format = function(object) {return JSON.stringify(object);} | 22 sinon.format = function(object) {return JSON.stringify(object);} |
| 23 sinon.log = function(message) {console.log(message);}; | 23 sinon.log = function(message) {console.log(message);}; |
| 24 var server = sinon.fakeServer.create(); | 24 var server = sinon.fakeServer.create(); |
| 25 server.autoRespond = true; | 25 if (!window.chai) { |
| 26 // server.autoRespondAfter = 1000; | 26 // If chai is defined, we are unit testing, so we don't want the delay |
| 27 // in the responses. If we aren't unit testing, we are in demo page |
| 28 // mode and add in the delay for realism. |
| 29 server.autoRespond = true; |
| 30 server.autoRespondAfter = 1000; |
| 31 } |
| 27 | 32 |
| 28 var data = []; | 33 var data = []; |
| 29 for (var i = 0; i < 27; i++) { | 34 for (var i = 0; i < 27; i++) { |
| 30 data.push({alpha: Math.random(), beta: Math.random(), gamma: i}); | 35 data.push({alpha: Math.random(), beta: Math.random(), gamma: i}); |
| 31 } | 36 } |
| 32 | 37 |
| 33 var MAX = 20; | 38 var MAX = 20; |
| 34 | 39 |
| 35 server.respondWith("GET", /^\/get.*/, function(request){ | 40 server.respondWith("GET", /^\/get.*/, function(request){ |
| 36 console.log("Request: ",request); | 41 console.log("Request: ",request); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 </template> | 83 </template> |
| 79 <script> | 84 <script> |
| 80 Polymer({ | 85 Polymer({ |
| 81 is: 'pageable-data-demo', | 86 is: 'pageable-data-demo', |
| 82 | 87 |
| 83 properties: { | 88 properties: { |
| 84 _parse: { | 89 _parse: { |
| 85 type: Function, | 90 type: Function, |
| 86 value: function() { | 91 value: function() { |
| 87 return function(json) { | 92 return function(json) { |
| 88 console.log("hello parse"); | |
| 89 return json.data; | 93 return json.data; |
| 90 }; | 94 }; |
| 91 }, | 95 }, |
| 92 }, | 96 }, |
| 93 }, | 97 }, |
| 94 | 98 |
| 95 attached: function(){ | 99 attached: function(){ |
| 96 this.$.pd.load("/get?foo=bar", {"X-Testing":"foobar"}, 10); | 100 this.$.pd.load("/get?foo=bar", {"X-Testing":"foobar"}, 10); |
| 97 }, | 101 }, |
| 98 | 102 |
| 99 }); | 103 }); |
| 100 </script> | 104 </script> |
| 101 </dom-module> | 105 </dom-module> |
| 102 | 106 |
| 103 <pageable-data-demo></pageable-data-demo> | 107 <pageable-data-demo></pageable-data-demo> |
| 104 | 108 |
| 105 </body> | 109 </body> |
| 106 </html> | 110 </html> |
| OLD | NEW |