Debian Codegraph @

closure-library/closure/goog/ui/roundedpanel_test.js

raw
1 // Copyright 2008 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 goog.provide('goog.ui.RoundedPanelTest');
16 goog.setTestOnly('goog.ui.RoundedPanelTest');
17
18 goog.require('goog.testing.jsunit');
19 goog.require('goog.ui.CssRoundedPanel');
20 goog.require('goog.ui.GraphicsRoundedPanel');
21 goog.require('goog.ui.RoundedPanel');
22 goog.require('goog.userAgent');
23
24
25 /**
26 * Tests goog.ui.RoundedPanel.create(), ensuring that the proper instance is
27 * created based on user-agent
28 */
29 function testRoundedPanelCreate() {
30 var rcp = goog.ui.RoundedPanel.create(
31 15, 5, '#cccccc', '#cccccc', goog.ui.RoundedPanel.Corner.ALL);
32 if (goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher('1.9a')) {
33 assertTrue(
34 'For Firefox 3.0+ (uses Gecko 1.9+), an instance of ' +
35 'goog.ui.CssRoundedPanel should be returned.',
36 rcp instanceof goog.ui.CssRoundedPanel);
37 } else if (goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher('500')) {
38 assertTrue(
39 'For Safari 3.0+, an instance of goog.ui.CssRoundedPanel ' +
40 'should be returned.',
41 rcp instanceof goog.ui.CssRoundedPanel);
42 } else if (goog.userAgent.EDGE) {
43 assertTrue(
44 'For MS Edge, an instance of goog.ui.CssRoundedPanel ' +
45 'should be returned.',
46 rcp instanceof goog.ui.CssRoundedPanel);
47 } else if (
48 goog.userAgent.GECKO || goog.userAgent.IE || goog.userAgent.OPERA ||
49 goog.userAgent.WEBKIT) {
50 assertTrue(
51 'For Gecko 1.8- (ex. Firefox 2.0-, Camino 1.5-, etc.), ' +
52 'IE, Opera, and Safari 2.0-, an instance of ' +
53 'goog.ui.GraphicsRoundedPanel should be returned.',
54 rcp instanceof goog.ui.GraphicsRoundedPanel);
55 } else {
56 assertNull('For non-supported user-agents, null is returned.', rcp);
57 }
58 }