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 <meta name='viewport' content='width=device-width, minimum-scale=1.0, initia
l-scale=1.0, user-scalable=yes'> |
| 7 <title>google-plusone Basic Tests</title> |
| 8 <script src="../../webcomponentsjs/webcomponentsjs.min.js"></script> |
| 9 <script src="../../web-component-tester/browser.js"></script> |
| 10 <link rel="import" href="../google-calendar.html"> |
| 11 </head> |
| 12 <body> |
| 13 |
| 14 <google-calendar-list title="What I'm up to"></google-calendar-list> |
| 15 |
| 16 <script> |
| 17 |
| 18 function testFetchesCalendars(calendarListEl) { |
| 19 var testCalendar = { |
| 20 'kind': 'calendar#calendarListEntry', |
| 21 'id': 'test_id', |
| 22 'summary': 'test summary', |
| 23 'description': 'test description', |
| 24 'timeZone': 'Asia/Calcutta', |
| 25 'backgroundColor': '#000' |
| 26 }; |
| 27 |
| 28 // Stub out calendar request call. |
| 29 var api = calendarListEl.$.calendar.api; |
| 30 var request = { |
| 31 'execute': function(callback) { |
| 32 var resp = { |
| 33 'items': [testCalendar] |
| 34 }; |
| 35 callback(resp); |
| 36 } |
| 37 }; |
| 38 sinon.stub(api.calendarList, 'list').returns(request); |
| 39 |
| 40 calendarListEl.displayCalendars(); |
| 41 Platform.flush(); |
| 42 |
| 43 // Check if calendars get updated. |
| 44 chai.expect(calendarListEl.calendars).to.eql([testCalendar]); |
| 45 }; |
| 46 |
| 47 document.addEventListener('polymer-ready', function() { |
| 48 var this = document.querySelector('google-calendar-list'); |
| 49 |
| 50 // Fake user's sign in. |
| 51 var signin = cal.shadowRoot.querySelector('google-signin-aware'); |
| 52 signin.dispatchEvent(new Event('google-signin-aware-success')); |
| 53 |
| 54 // Run tests. |
| 55 this.addEventListener('google-api-load', function() { |
| 56 testFetchesCalendars(this); |
| 57 done(); |
| 58 }); |
| 59 }); |
| 60 </script> |
| 61 </body> |
| 62 </html> |
OLD | NEW |