Skip to content

Commit

Permalink
Start very basic test support
Browse files Browse the repository at this point in the history
  • Loading branch information
amire80 committed Oct 16, 2012
1 parent d9a191d commit 0814643
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "libs/qunit"]
path = libs/qunit
url = git://github.com/jquery/qunit.git
1 change: 1 addition & 0 deletions libs/qunit
Submodule qunit added at dbd005
33 changes: 33 additions & 0 deletions test/index.html
@@ -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>

22 changes: 22 additions & 0 deletions test/jquery.ime.test.js
@@ -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.