Debian Codegraph @

closure-library/closure/goog/style/style_webkit_scrollbars_test.js

raw
1 // Copyright 2011 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.style.webkitScrollbarsTest');
16 goog.setTestOnly('goog.style.webkitScrollbarsTest');
17
18 goog.require('goog.asserts');
19 goog.require('goog.style');
20 /** @suppress {extraRequire} */
21 goog.require('goog.styleScrollbarTester');
22 goog.require('goog.testing.ExpectedFailures');
23 goog.require('goog.testing.jsunit');
24 goog.require('goog.userAgent');
25
26 var expectedFailures;
27
28 function setUpPage() {
29 expectedFailures = new goog.testing.ExpectedFailures();
30 }
31
32 function tearDown() {
33 expectedFailures.handleTearDown();
34
35 // Assert that the test loaded.
36 goog.asserts.assert(testScrollbarWidth);
37 }
38
39 function testScrollBarWidth_webkitScrollbar() {
40 expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT);
41
42 try {
43 var width = goog.style.getScrollbarWidth();
44 assertEquals('Scrollbar width should be 16', 16, width);
45 } catch (e) {
46 expectedFailures.handleException(e);
47 }
48 }
49
50 function testScrollBarWidth_webkitScrollbarWithCustomClass() {
51 expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT);
52
53 try {
54 var customWidth = goog.style.getScrollbarWidth('otherScrollBar');
55 assertEquals('Custom width should be 10', 10, customWidth);
56 } catch (e) {
57 expectedFailures.handleException(e);
58 }
59 }