Add qunit test structure

This commit is contained in:
conzett 2011-11-22 15:44:08 -05:00
parent 2dfa28cea9
commit 2129d1fc67
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
</head>
<body>
<h1 id="qunit-header">Table Tests</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">test markup, will be hidden</div>
</body>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
<script type="text/javascript" src="../tabs.js"></script>
<script type="text/javascript" src="tests.js"></script>
</html>

View File

@ -0,0 +1,41 @@
$(document).ready(function () {
module("Table markup creation");
var data = {
"table": {
"columns": [
{
"name": "firstName",
"displayName": "First Name"
},
{
"name": "lastName",
"displayName": "Last Name"
}
]
}
}
test("Generate table headers", function () {
$('#qunit-fixture').tablePlugin(data);
var table = $('#qunit-fixture');
var thead = table.find("thead tr");
equal(thead.find('th').size(),
data.table.columns.length,
"Expect number of generated table headers to match number in model");
equal(thead.find('th').first().html(),
data.table.columns[0].displayName,
"Expect inner HTML to be display name");
equal(thead.find('th').first().attr('data-name'),
data.table.columns[0].name,
"Expect data-name attribute to be set to name");
});
});