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
|
<!DOCTYPE html>
<html>
<!--
Copyright 2008 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.
-->
<!--
Author: attila@google.com (Attila Bodis)
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.ui.Tab</title>
<script src="../base.js"></script>
<script>
goog.require('goog.dom');
goog.require('goog.testing.jsunit');
goog.require('goog.ui.Component.State');
goog.require('goog.ui.Tab');
goog.require('goog.ui.TabRenderer');
</script>
</head>
<body>
<div id="sandbox"></div>
<script>
var sandbox = goog.dom.getElement('sandbox');
var tab;
function setUp() {
tab = new goog.ui.Tab('Hello');
}
function tearDown() {
tab.dispose();
goog.dom.removeChildren(sandbox);
}
function testConstructor() {
assertNotNull('Tab must not be null', tab);
assertEquals('Tab must have expected content', 'Hello', tab.getContent());
assertEquals('Tab\'s renderer must default to TabRenderer',
goog.ui.TabRenderer.getInstance(), tab.getRenderer());
assertTrue('Tab must support the SELECTED state',
tab.isSupportedState(goog.ui.Component.State.SELECTED));
assertTrue('SELECTED must be an auto-state',
tab.isAutoState(goog.ui.Component.State.SELECTED));
assertTrue('Tab must dispatch transition events for the DISABLED state',
tab.isDispatchTransitionEvents(goog.ui.Component.State.DISABLED));
assertTrue('Tab must dispatch transition events for the SELECTED state',
tab.isDispatchTransitionEvents(goog.ui.Component.State.SELECTED));
}
function testGetSetTooltip() {
assertUndefined('Tooltip must be undefined by default', tab.getTooltip());
tab.setTooltip('Hello, world!');
assertEquals('Tooltip must have expected value', 'Hello, world!',
tab.getTooltip());
}
</script>
</body>
</html>
|