Permalink
Browse files

Start very basic test support

  • Loading branch information...
amire80 committed Oct 14, 2012
1 parent d9a191d commit 08146434f65bc27d4ded91628fc9631bb2a1470c
Showing with 59 additions and 0 deletions.
  1. +3 −0 .gitmodules
  2. +1 −0 libs/qunit
  3. +33 −0 test/index.html
  4. +22 −0 test/jquery.ime.test.js
View
@@ -0,0 +1,3 @@
+[submodule "libs/qunit"]
+ path = libs/qunit
+ url = git://github.com/jquery/qunit.git
Submodule qunit added at dbd005
View
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery.ime Test Suite</title>
+
+ <!-- External libs -->
+ <script src="../libs/jquery.js"></script>
+
+ <!-- Source of our libs -->
+ <script src="../src/jquery.ime.js"></script>
+ <script src="../src/jquery.ime.selector.js"></script>
+ <script src="../src/jquery.ime.preferences.js"></script>
+ <script src="../src/jquery.ime.inputmethods.js"></script>
+
+ <!-- Test framework -->
+ <link rel="stylesheet" href="../libs/qunit/qunit/qunit.css">
+ <script src="../libs/qunit/qunit/qunit.js"></script>
+
+ <!-- Test config -->
+ <script>
+ QUnit.config.requireExpects = true;
+ </script>
+
+ <!-- Test Suite -->
+ <script src="jquery.ime.test.js"></script>
+</head>
+<body>
+ <div id="qunit"></div>
+ <div id="qunit-fixture"></div>
+</body>
+</html>
+
View
@@ -0,0 +1,22 @@
+( function ( $ ) {
+ 'use strict';
+
+ var $textarea, $input;
+
+ QUnit.module( 'jquery.ime - $.fn.ime Tests', {
+ setup: function () {
+ $textarea = $( '<textarea>' );
+ $input = $( '<input>' );
+ },
+ teardown: function () {
+ }
+ } );
+
+ QUnit.test( 'Initialization', 3, function ( assert ) {
+ assert.strictEqual( typeof $textarea.ime, 'function', 'ime function exists' );
+ assert.strictEqual( typeof $textarea.data('ime'), 'undefined', 'ime not initialized before calling ime()' );
+
+ $textarea.ime();
+ assert.strictEqual( typeof $textarea.data('ime'), 'object', 'ime initialized after calling ime()' );
+ } );
+}( jQuery ) );

0 comments on commit 0814643

Please sign in to comment.