Index: polymer_1.0.4/bower_components/google-hangout-button/tests/google-hangout-button-basic.html |
diff --git a/polymer_1.0.4/bower_components/google-hangout-button/tests/google-hangout-button-basic.html b/polymer_1.0.4/bower_components/google-hangout-button/tests/google-hangout-button-basic.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7eefd3cd1071f046efc26fa6832d5930f97f8e9b |
--- /dev/null |
+++ b/polymer_1.0.4/bower_components/google-hangout-button/tests/google-hangout-button-basic.html |
@@ -0,0 +1,73 @@ |
+<!doctype html> |
+<!-- Copyright (c) 2014 Google Inc. All rights reserved. --> |
+<html> |
+ <head> |
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> |
+ <title>google-plusone Basic Tests</title> |
+ <script src="../../webcomponentsjs/webcomponents.min.js"></script> |
+ <link rel="import" href="../../polymer-test-tools/tools.html"> |
+ <script src="../../polymer-test-tools/htmltest.js"></script> |
+ <script src="../../sinon-browser-only/sinon.js"></script> |
+ <link rel="import" href="../google-hangout-button.html"> |
+ </head> |
+ <body> |
+ <google-hangout-button |
+ type="party" |
+ apps="[{'app_id': '184219133185', 'start_data': 'dQw4w9WgXcQ', 'app_type': 'ROOM_APP' }]" |
+ topic="test topic" |
+ invites="[{ id: 'foo@example.com', invite_type: 'EMAIL' }]" |
+ width="72"> |
+ </google-hangout-button> |
+ <script> |
+ function testIframeCreated(hangoutButton) { |
+ chai.assert.ok(hangoutButton.shadowRoot.querySelector('iframe')); |
+ } |
+ |
+ function testHangoutArgumentsAreApplied(hangoutButton, apiSpy) { |
+ chai.assert.ok(apiSpy.calledOnce); |
+ chai.assert.ok(apiSpy.calledWith(sinon.match.any, sinon.match({ |
+ 'hangout_type': 'party' |
+ })), 'Loaded hangout type different than requested type'); |
+ |
+ chai.assert.ok(apiSpy.calledWith(sinon.match.any, sinon.match({ |
+ 'initial_apps': "[{'app_id': '184219133185', 'start_data': " + |
+ "'dQw4w9WgXcQ', 'app_type': 'ROOM_APP' }]" |
+ })), 'Loaded apps different than requested apps'); |
+ |
+ chai.assert.ok(apiSpy.calledWith(sinon.match.any, sinon.match({ |
+ 'topic': "test topic" |
+ })), 'Loaded topic different than requested topic'); |
+ |
+ chai.assert.ok(apiSpy.calledWith(sinon.match.any, sinon.match({ |
+ 'invites': "[{ id: 'foo@example.com', invite_type: 'EMAIL' }]" |
+ })), 'Loaded invites different than requested invites'); |
+ |
+ chai.assert.ok(apiSpy.calledWith(sinon.match.any, sinon.match({ |
+ 'widget_size': 72 |
+ })), 'Loaded width different than requested width'); |
+ } |
+ |
+ document.addEventListener('polymer-ready', function() { |
+ |
+ var hg = document.querySelector('google-hangout-button'); |
+ var apiSpy; |
+ |
+ // Set up Api spies. |
+ hg.addEventListener('google-hangout-button-pregame', function() { |
+ var yt = hg.shadowRoot.querySelector('google-plusone-api'); |
+ apiSpy = sinon.spy(yt.api.hangout, 'render'); |
+ }); |
+ |
+ hg.addEventListener('google-hangout-button-ready', function() { |
+ // Check if element's arguments are applied. |
+ testHangoutArgumentsAreApplied(hg, apiSpy); |
+ // Check if the hangout button iframe is created. |
+ testIframeCreated(hg); |
+ // Reset spies. |
+ apiSpy.reset(); |
+ done(); |
+ }); |
+ }); |
+ </script> |
+ </body> |
+</html> |