OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <!-- Copyright (c) 2014 Google Inc. All rights reserved. --> |
| 3 <html> |
| 4 <head> |
| 5 <meta charset="utf-8"> |
| 6 <title>google-sheet tests</title> |
| 7 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1.0, user-scalable=yes"> |
| 8 |
| 9 <script src="../../../platform/platform.js"></script> |
| 10 <link rel="import" href="../../../polymer-test-tools/tools.html"> |
| 11 <script src="../../../polymer-test-tools/htmltest.js"></script> |
| 12 |
| 13 <link rel="import" href="../google-sheets.html"> |
| 14 </head> |
| 15 <body> |
| 16 |
| 17 <div> |
| 18 <p>Tests live private spreadsheet data.</p> |
| 19 <p>This test needs to be run manually, standalone in order to fetch an OAuth t
oken.</p> |
| 20 |
| 21 <b>NOTES:</b><br> |
| 22 <li>run manually off of localhost:3000/google-sheets/tests/private.html. Can a
lso run from port 8080.</li> |
| 23 <li>use the account: webcomponents.test@gmail.com</li> |
| 24 </div> |
| 25 |
| 26 <google-sheets id="sheet" gid="1" |
| 27 clientId="750497606405-1hq66meqmr4dp09dn54j9ggv85vbv0gp.apps.googleuserco
ntent.com" |
| 28 key="0AjqzxJ5RoRrWdGh2S0RRYURXTlNHdm9pQlFuM1ZwZWc"></google-sheets> |
| 29 |
| 30 <script> |
| 31 document.addEventListener('polymer-ready', function() { |
| 32 |
| 33 (function() { |
| 34 var sheet = document.querySelector('#sheet'); |
| 35 var root = sheet.shadowRoot; |
| 36 |
| 37 // Test set attributes. |
| 38 assert.equal(sheet.key, |
| 39 '0AjqzxJ5RoRrWdGh2S0RRYURXTlNHdm9pQlFuM1ZwZWc', ".key was not updated"); |
| 40 assert.equal(sheet.gid, 1, '.gid was not updated'); |
| 41 assert.equal(sheet.clientId, |
| 42 '750497606405-1hq66meqmr4dp09dn54j9ggv85vbv0gp.apps.googleusercontent.co
m', ".clientId was not set"); |
| 43 |
| 44 sheet.addEventListener('google-sheet-data', function(e) { |
| 45 |
| 46 switch (e.detail.type) { |
| 47 case 'spreadsheets': |
| 48 assert.isTrue(this.spreadsheets.length > 0, |
| 49 '.spreadsheets should be populated for private feeds.'); |
| 50 break; |
| 51 case 'tab': |
| 52 assert.equal(this.tab.title, 'SECONDTAB', '.tab.title is incorrect'); |
| 53 break; |
| 54 case 'rows': |
| 55 assert.lengthOf(this.rows.authors, 1, '.rows.authors array'); |
| 56 |
| 57 var name = this.rows.authors[0].name; |
| 58 var email = this.rows.authors[0].email |
| 59 |
| 60 assert.equal(email, 'webcomponents.test@gmail.com', 'author email not
set correctly'); |
| 61 assert.equal(name, 'webcomponents.test', 'author name not set correctl
y'); |
| 62 |
| 63 assert.equal(this.rows[0].title.$t, 'FIRST NAME', '"name" column was i
ncorrect'); |
| 64 assert.equal(this.rows[1].gsx$state.$t, 'OR', '"state" column was inco
rrect'); |
| 65 |
| 66 break; |
| 67 default: |
| 68 // Noop |
| 69 } |
| 70 |
| 71 done(); |
| 72 |
| 73 }); |
| 74 |
| 75 })(); |
| 76 |
| 77 }); |
| 78 </script> |
| 79 </body> |
| 80 </html> |
| 81 |
OLD | NEW |