Tests: Core tests for disableSelection
authorPrzemyslaw Ciezkowski <p.ciezkowski@samsung.com>
Fri, 5 Apr 2013 16:11:50 +0000 (18:11 +0200)
committerYoumin Ha <youmin.ha@samsung.com>
Wed, 10 Apr 2013 14:57:34 +0000 (23:57 +0900)
Change-Id: Ib8d41667dc43aca65d52537da3a8645451697672

tests/unit-tests/core/core-tests.js [new file with mode: 0644]
tests/unit-tests/core/index.html [new file with mode: 0644]
tests/unit-tests/tests.js

diff --git a/tests/unit-tests/core/core-tests.js b/tests/unit-tests/core/core-tests.js
new file mode 100644 (file)
index 0000000..a4811e4
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Unit Test: Core
+ *
+ * Przemyslaw Ciezkowski <p.ciezkowski@samsung.com>
+ */
+
+$( "#corepage" ).live( "pageinit", function ( event ) {
+       module("Core");
+
+       test( "Disable text selection", function () {
+               var all = $( event.target ).find("*"),
+                       haveDisabled = all.not( "input, [type='text'], textarea" ),
+                       haveEnabled = all.filter( "input, [type='text'], textarea" );
+               $.mobile.tizen.disableSelection( $( event.target ) );
+
+               haveDisabled.each( function () {
+                       strictEqual( $(this).css( "user-select" ), "none" );
+               } );
+
+               haveEnabled.each( function () {
+                       strictEqual( $(this).css( "user-select" ), "text" );
+               } );
+       } );
+
+} );
\ No newline at end of file
diff --git a/tests/unit-tests/core/index.html b/tests/unit-tests/core/index.html
new file mode 100644 (file)
index 0000000..a7fd702
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+       <script src="../../../build/tizen-web-ui-fw/latest/js/jquery.js"></script>
+       <script src="../../../build/tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.min.js"></script>
+       <script src="../../../build/tizen-web-ui-fw/latest/js/tizen-web-ui-fw.js"
+               data-framework-theme="tizen-white"
+               data-framework-viewport-scale=false>
+       </script>
+       <link rel="stylesheet" href="../../../libs/js/jquery-mobile-1.2.0/external/qunit.css" />
+       <script src="../../../libs/js/jquery-mobile-1.2.0/tests/jquery.testHelper.js"></script>
+       <script src="../../../libs/js/jquery-mobile-1.2.0/external/qunit.js"></script>
+       <script src="core-tests.js"></script>
+       <title>Core</title>
+</head>
+
+<body>
+
+<h1 id="qunit-header">Core</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests"></ol>
+
+<div id="qunit-fixture">
+       <div data-role="page" id="corepage">
+               <div data-role="header" data-position="fixed">
+                       <h1>Single-Page Application </h1>
+               </div><!-- /header -->
+
+               <div data-role="content">
+                       <p>This is a single page boilerplate template that you can copy to build your first Tizen Web UI Framework page.</p>
+                       <input type="text" />
+                       <input type="button" value="Test" />
+                       <button>Test</button>
+                       <textarea></textarea>
+               </div><!-- /content -->
+
+               <div data-role="footer" data-position="fixed">
+                       <h4>Footer content</h4>
+               </div><!-- /footer -->
+       </div><!-- /page -->
+</div>
+
+</body>
+</html>
index 5758f94..1f174c5 100755 (executable)
@@ -2,6 +2,7 @@ var TESTS = {
        "testPages":[
                // Put your test here
                "button",
+               "core",
                "check",
                "tabbar",
                "datetimepicker",