76e7032d04a93c17c87f61a91c22b258a3130f9d
[test/tct/web/uifw.git] /
1 <!DOCTYPE html>
2 <html>
3 <head>
4         <link rel="stylesheet" href="../../../../../../libs/qunit-1.11.0.css" />
5         <title>Fieldcontain</title>
6 </head>
7
8 <body>
9         <h1 id="qunit-header">Fieldcontain</h1>
10         <h2 id="qunit-banner"></h2>
11         <div id="qunit-testrunner-toolbar"></div>
12         <h2 id="qunit-userAgent"></h2>
13         <ol id="qunit-tests"></ol>
14
15         <div id="qunit-fixture">
16                 <div data-role="page" id="page">
17                         <div data-role="content">
18                                 <!-- Basic fieldcontain test -->
19                                 <div id="test-fieldcontain" data-role="fieldcontain">
20                                         <label for="name">Text Input:</label>
21                                         <input type="text" name="name" id="name" value=""  />
22                                 </div>
23
24                                 <div id="without-text" data-role="fieldcontain">
25                                         <label for="name">Text Input:</label>
26                                         <input type="text" name="name" id="name" value=""  />
27                                 </div>
28
29                                 <div id="with-text" data-role="fieldcontain"> 
30                                         text <label for="name">Text Input:</label>
31                                         <input type="text" name="name" id="name" value=""  />
32                                 </div>
33                         </div>
34                 </div>
35         </div>
36
37         <script src="../../../../../../libs/jquery.js"></script>
38         <script src="../../../../../../libs/qunit-1.11.0.js"></script>
39         <script src="../../../../../../libs/support.js"></script>
40         <script>
41                 module("fieldContain", {
42                         teardown: function () {
43                                 ej.engine._clearBindings();
44                         }
45                 });
46
47                 function cssStyles ( fieldcontain ) {
48                         ok( fieldcontain.hasClass('ui-field-contain'), 'A fieldcontain element must contain styles ui-field-contain.' );
49                         ok( fieldcontain.hasClass('ui-br'), 'A fieldcontain element must contain styles ui-br.' );
50                         ok( fieldcontain.hasClass('ui-body'), 'A fieldcontain element must contain styles ui-body.' );
51                 }
52
53                 test( "Field container contains appropriate css styles.", function(){
54                         ok( !$('#test-fieldcontain').hasClass('ui-field-contain'), 'A fieldcontain element does not contain styles ui-field-contain before building.' );
55                         $('#test-fieldcontain').fieldcontain();
56                         cssStyles( $('#test-fieldcontain') );
57                 });
58
59                 test( "Field container contains only not-empty text nodes after building.", function(){
60                                 equal( $('#without-text')[0].childNodes.length, 5, 'Before building the empty text nodes should exist.' );
61                                 $('#without-text').fieldcontain();
62                                 cssStyles( $('#without-text') );
63                                 equal( $('#without-text')[0].childNodes.length, 2, 'Afret building field container the empty text nodes should be delated.' );
64
65                                 equal($('#with-text')[0].childNodes.length, 5, 'Before building the empty text nodes should exist.' );
66                                 $('#with-text').fieldcontain();
67                                 cssStyles( $('#with-text') );
68                                 equal( $('#with-text')[0].childNodes.length, 3, 'Afret building field container only empty text nodes should be delated.' );
69                 });
70         </script>
71         <script type="text/javascript">
72                 var tauConfig = {
73                         "autorun": false
74                 };
75         </script>
76         <script type="text/javascript" src="../../../../../../libs/dist/js/tau.js"></script>
77
78 </body>
79 </html>
80
81
82