This repository was archived by the owner on Jan 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-basic.html
81 lines (78 loc) · 2.59 KB
/
test-basic.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- Qunit -->
<script src="qunit/jquery.js"></script>
<link rel="stylesheet" href="qunit/qunit.css" type="text/css"
media="screen"/>
<script type="text/javascript" src="qunit/qunit.js"></script>
<!-- Lib -->
<script src="../lib/wef/build/wef.js"></script>
<!-- Src -->
<script src="../src/templateLayout.js"></script>
<script src="../src/templateLayout.compiler.js"></script>
<script src="../src/templateLayout.generator.js"></script>
<!-- Example style -->
<link rel="stylesheet" href="test.css" type="text/css"
media="screen"/>
<script type="text/javascript">
window.onload = function () {
var text = "#parent {display: \"abcd\"} #child1 {position: d} #child2 {position: c} #child3 {position: b} #child4 {position: a}";
templateLayout(text).transform();
<!-- Test code -->
test("width", function () {
equal($("#parent").children().width(),
$("#child1").width() + $("#child2").width() +
$("#child3").width() + $("#child4").width(),
"parentWidth = child_1_Width + ...+ child_n_Width");
});
test("cols", function(){
// get col count with jquery
// $('templateLayoutTable tr:eq(0) td').length
equal($('#parent .templateLayoutTable tr:eq(0) td').length, 4,
"4 columns");
});
test("rows", function(){
equal($("#parent .templateLayoutTable tr").length, 1,
"1 row");
});
}
</script>
<title></title>
</head>
<body>
<!-- Qunit code -->
<div>
<div id="qunit-header">CSS Template Layout test - One row layout</div>
<div id="qunit-banner"></div>
<div id="qunit-testrunner-toolbar"></div>
<div id="qunit-userAgent"></div>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup, will be hidden</div>
<div style="margin: 50px"></div>
</div>
<div>
<h1>First</h1>
<h2>Second</h2>
<h3>Third</h3>
<h4>Fourth</h4>
</div>
<hr/>
<pre>
#parent {display: "abcd"}
#child1 {position: d} //First
#child2 {position: c} //Second
#child3 {position: b} //Third
#child4 {position: a} //Fourth
</pre>
<hr/>
<!-- Test -->
<div id="parent">
<h1 id="child1">First</h1>
<h2 id="child2">Second</h2>
<h3 id="child3">Third</h3>
<h4 id="child4">Fourth</h4>
</div>
</body>
</html>