4 <link rel="stylesheet" href="../../../../../../libs/qunit-1.11.0.css" />
5 <title>Fieldcontain</title>
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>
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="" />
24 <div id="without-text" data-role="fieldcontain">
25 <label for="name">Text Input:</label>
26 <input type="text" name="name" id="name" value="" />
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="" />
37 <script src="../../../../../../libs/jquery.js"></script>
38 <script src="../../../../../../libs/qunit-1.11.0.js"></script>
39 <script src="../../../../../../libs/support.js"></script>
41 module("fieldContain", {
42 teardown: function () {
43 ej.engine._clearBindings();
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.' );
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') );
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.' );
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.' );
71 <script type="text/javascript">
76 <script type="text/javascript" src="../../../../../../libs/dist/js/tau.js"></script>