This repository was archived by the owner on May 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathfirebase-common-behavior.html
More file actions
111 lines (93 loc) · 3.22 KB
/
firebase-common-behavior.html
File metadata and controls
111 lines (93 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!doctype html>
<!--
@license
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://github.com/firebase/polymerfire/blob/master/LICENSE
-->
<html>
<head>
<meta charset="UTF-8">
<title>FirebaseCommonBehavior tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link rel="import" href="../../app-storage/test/app-storage-compatibility-suite.html">
<link rel="import" href="../firebase-common-behavior.html">
<link rel="import" href="../firebase-app.html">
</head>
<body>
<firebase-app
name="test"
api-key="AIzaSyDTP-eiQezleFsV2WddFBAhF_WEzx_8v_g"
auth-domain="polymerfire-test.firebaseapp.com"
database-url="https://polymerfire-test.firebaseio.com">
</firebase-app>
<firebase-app
name="alt"
api-key="AIzaSyDTP-eiQezleFsV2WddFBAhF_WEzx_8v_g"
auth-domain="polymerfire-test.firebaseapp.com"
database-url="https://polymerfire-test.firebaseio.com">
</firebase-app>
<firebase-app
api-key="AIzaSyDTP-eiQezleFsV2WddFBAhF_WEzx_8v_g"
auth-domain="polymerfire-test.firebaseapp.com"
database-url="https://polymerfire-test.firebaseio.com">
</firebase-app>
<test-fixture id="BasicCommon">
<template>
<x-firebase-common></x-firebase-common>
</template>
</test-fixture>
<test-fixture id="NamedCommon">
<template>
<x-firebase-common app-name="test"></x-firebase-common>
</template>
</test-fixture>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'x-firebase-common',
behaviors: [
Polymer.FirebaseCommonBehavior
]
});
});
suite('FirebaseCommonBehavior', function() {
var commonElement;
suite('without a name', function() {
setup(function() {
commonElement = fixture('BasicCommon');
});
test('sets app to the default app', function() {
expect(commonElement.app.name).to.be.equal(firebase.app().name);
});
suite('when an app is set', function() {
test('changes the appName to the app\'s name', function() {
commonElement.app = firebase.app('test');
expect(commonElement.appName).to.be.equal('test');
});
});
});
suite('with a name', function() {
setup(function() {
commonElement = fixture('NamedCommon');
});
test('sets app to the named app', function() {
expect(commonElement.app.name).to.be.equal(firebase.app('test').name);
});
suite('when the name is changed', function() {
test('changes to the appropriate app', function() {
commonElement.appName = 'alt';
expect(commonElement.app.name).to.be.equal(firebase.app('alt').name);
});
test('if no name is specified, selects default app', function() {
commonElement.appName = null;
expect(commonElement.app.name).to.be.equal(firebase.app().name);
});
});
});
});
</script>
</body>