blob: d1a769ae8b03cf0df5a54299fcd80945bc621a39 (
plain)
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
|
<!DOCTYPE html>
<html>
<!--
Copyright 2011 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.dom.style</title>
<script src="../base.js"></script>
<script>
goog.require('goog.style');
goog.require('goog.style_test');
goog.require('goog.testing.jsunit');
goog.require('goog.testing.ExpectedFailures');
goog.require('goog.userAgent');
</script>
<style>
/*
* Note that we have to apply these styles when the page is loaded or the
* scrollbars might not pick them up.
*/
::-webkit-scrollbar {
width: 16px;
height: 16px;
}
.otherScrollBar::-webkit-scrollbar {
width: 10px;
height: 10px;
}
</style>
</head>
<body>
<div id="test-scrollbarwidth" style="background-color: orange; width: 100px; height: 100px; overflow: auto;">
<div style='width: 200px; height: 200px; background-color: red'>Test Scroll bar width with scroll</div>
</div>
<script>
var expectedFailures = new goog.testing.ExpectedFailures();
function tearDown() {
expectedFailures.handleTearDown();
}
function testScrollBarWidth() {
goog.style_test.testScrollbarWidth();
}
function testScrollBarWidth_webkitScrollbar() {
expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT);
try {
var width = goog.style.getScrollbarWidth();
assertEquals('Scrollbar width should be 16', 16, width);
} catch (e) {
expectedFailures.handleException(e);
}
}
function testScrollBarWidth_webkitScrollbarWithCustomClass() {
expectedFailures.expectFailureFor(!goog.userAgent.WEBKIT);
try {
var customWidth = goog.style.getScrollbarWidth('otherScrollBar');
assertEquals('Custom width should be 10', 10, customWidth);
} catch (e) {
expectedFailures.handleException(e);
}
}
</script>
</body>
</html>
|