Skip to content

Commit

Permalink
FLOE-399: refactored test
Browse files Browse the repository at this point in the history
Refactored the tests for gpii.chartAuthoring.percentage.render to have QUnit perform the DOM cleanup.
  • Loading branch information
jobara committed Jul 28, 2015
1 parent a85e2b7 commit 4c230ff
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/js/percentageTests.js
Expand Up @@ -79,24 +79,19 @@ https://github.com/gpii/universal/LICENSE.txt
["10.5%", "10.5%", "10%", "10%", "10.5%", "10.5%", "10%", "10%"] // template === "%percentage%"
];

jqUnit.test("Test gpii.chartAuthoring.percentage.render", function () {
var elm = $(".renderPerencentage-test");
fluid.each(gpii.tests.renderPerencentage.templates, function (template, templateIdx) {
fluid.each(gpii.tests.retrieveVal.percentages, function (percentage, perIdx) {
// make sure the text is reset
elm.text("");

fluid.each(gpii.tests.renderPerencentage.templates, function (template, templateIdx) {
fluid.each(gpii.tests.retrieveVal.percentages, function (percentage, perIdx) {
jqUnit.test("Test gpii.chartAuthoring.percentage.render - percentage: " + percentage + ", template: " + template, function () {
var elm = $(".renderPerencentage-test");
var expected = gpii.tests.renderPerencentage.outputs[templateIdx][perIdx];
gpii.chartAuthoring.percentage.render(elm, percentage, template);
var actual = elm.text();
jqUnit.assertEquals("The percentage should be rendered into the DOM correctly.", expected, actual);

// cleanup after test
elm.text("");
});
});
});


fluid.registerNamespace("gpii.tests.percentagesIfValue");

gpii.tests.percentagesIfValue.values = [undefined, null, NaN, "", false, true, 0, "0", 10];
Expand Down

0 comments on commit 4c230ff

Please sign in to comment.