Skip to content

Commit

Permalink
Merge pull request #241 from MayaKirova/master
Browse files Browse the repository at this point in the history
Adding tests for getColType and ig.formatter functions
  • Loading branch information
kdinev authored Aug 18, 2016
2 parents 571bff5 + 70207e5 commit e03f10b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/unit/util/formatter/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@
equal("dMartes y MMM m s t f h H", stringValue);
});
}

test("test checkbox format", function () {
var stringValue = $.ig.formatter(true, "checkbox", "checkbox", true, false, "block", "labelText", 1);
equal(stringValue,
"<span class='ui-igcheckbox-container' style='display:block;' role='checkbox' aria-disabled='true' aria-checked='true' aria-label='labelText' tabindex='1'><span class='' style='display:inline-block'><span style='display:block' class='ui-icon ui-icon-check ui-igcheckbox-small-on'></span></span></span>",
"Verify the checkbox format is properly applied.");

stringValue = $.ig.formatter(false, "checkbox", "checkbox", true, false, "block", "labelText", 1);

equal(stringValue,
"<span class='ui-igcheckbox-container' style='display:block;' role='checkbox' aria-disabled='true' aria-checked='false' aria-label='labelText' tabindex='1'><span class='' style='display:inline-block'><span style='display:block' class='ui-igcheckbox-small-off ui-icon ui-icon-check ui-igcheckbox-small-on'></span></span></span>",
"Verify the checkbox format is properly applied.");
});

function runEscapeTests() {
test("testescape", function() {
Expand Down
53 changes: 53 additions & 0 deletions tests/unit/util/tests.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<link type="text/css" href="../../../bower_components/qunit/qunit/qunit.css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="../../../bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="../../../bower_components/jquery-tmpl/jquery.tmpl.js"></script>
<script type="text/javascript" src="../../../bower_components/jquery-ui/jquery-ui.js"></script>
<script type="text/javascript" src="../../../bower_components/qunit/qunit/qunit.js"></script>



<!--JS Debug-->
<script type="text/javascript" src="../../../src/js/modules/i18n/regional/infragistics.ui.regional-bg.js"></script>
<script type="text/javascript" src="../../../src/js/modules/i18n/regional/infragistics.ui.regional-en.js"></script>
<script type="text/javascript" src="../../../src/js/modules/i18n/regional/infragistics.ui.regional-es.js"></script>
<script type="text/javascript" src="../../../src/js/modules/infragistics.util.js"></script>

<script type="text/javascript">
module("Basic Tests");
// run tests

test("Test getColType function",function(){
var result = $.ig.getColType(new Date());
equal(result, "date", "Check if result is correct for the object type.");

result = $.ig.getColType(1);
equal(result, "number", "Check if result is correct for the object type.");

result = $.ig.getColType("1");
equal(result, "string", "Check if result is correct for the object type.");

result = $.ig.getColType(true);
equal(result, "bool", "Check if result is correct for the object type.");

result = $.ig.getColType([1, 2, 3]);
equal(result, "object", "Check if result is correct for the object type.");

result = $.ig.getColType(undefined);
equal(result, "string", "Check if result is correct for the object type.");
});

</script>
</head>
<body>
<div style="float:right;width:400px;overflow:auto;">
<h1 id="qunit-header">Test results</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</div>
</body>
</html>

0 comments on commit e03f10b

Please sign in to comment.