From 09c7ad104a8334ccd38ddfb68da460b1b2eaa11c Mon Sep 17 00:00:00 2001 From: Edward Alexander Rojas Date: Thu, 27 Aug 2015 16:37:31 +0200 Subject: [PATCH] Fixed accordion sample after changes on store - Updating sample according to 11a4c8d - Optimizing functional test --- samples/Accordion.html | 25 +++++++++++-------------- tests/functional/Accordion.js | 24 ++++++++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/samples/Accordion.html b/samples/Accordion.html index 47164e6983..8487650249 100644 --- a/samples/Accordion.html +++ b/samples/Accordion.html @@ -20,7 +20,6 @@ "deliteful/Accordion", "deliteful/Panel", "deliteful/LinearLayout", - "deliteful/Store", "deliteful/list/List", "deliteful/Button", "delite/theme!delite/themes/{{theme}}/global.css", // page level CSS @@ -52,18 +51,6 @@ - - {"label": "list item 0", "righttext": "right text A"}, - {"label": "list item 1", "righttext": "right text B"}, - {"label": "list item 2", "righttext": "right text C"}, - {"label": "list item 3", "righttext": "right text D"}, - {"label": "list item 4", "righttext": "right text E"}, - {"label": "list item 5", "righttext": "right text F"}, - {"label": "list item 6", "righttext": "right text G"}, - {"label": "list item 7", "righttext": "right text H"}, - {"label": "list item 8", "righttext": "right text I"}, - {"label": "list item 9", "righttext": "right text J"} -
@@ -94,7 +81,17 @@

Third content

- + + {"label": "list item 0", "righttext": "right text A"}, + {"label": "list item 1", "righttext": "right text B"}, + {"label": "list item 2", "righttext": "right text C"}, + {"label": "list item 3", "righttext": "right text D"}, + {"label": "list item 4", "righttext": "right text E"}, + {"label": "list item 5", "righttext": "right text F"}, + {"label": "list item 6", "righttext": "right text G"}, + {"label": "list item 7", "righttext": "right text H"}, + {"label": "list item 8", "righttext": "right text I"}, + {"label": "list item 9", "righttext": "right text J"} diff --git a/tests/functional/Accordion.js b/tests/functional/Accordion.js index 59ba4af54e..24d1c8e829 100644 --- a/tests/functional/Accordion.js +++ b/tests/functional/Accordion.js @@ -30,17 +30,19 @@ define(["intern", assert.isTrue(displayed, "This button should be visible"); }) .end() - .findById(panel) .findByCssSelector(".d-panel-content") .isDisplayed() .then(function (displayed) { assert.isTrue(displayed, "The content of this panel should be visible"); }) - .then(pollUntil(function (value) { - var classes = document.getElementById(value).getAttribute("class"); - classes = classes.trim().split(/\s+/g); - return classes.indexOf("d-accordion-open-panel") !== -1 ? true : null; - }, [panel], intern.config.WAIT_TIMEOUT, intern.config.POLL_INTERVAL)) + .execute("return document.getElementById(" + panel + ")") + .then(function (elem) { + pollUntil(function (value) { + var classes = value.getAttribute("class"); + classes = classes.trim().split(/\s+/g); + return classes.indexOf("d-accordion-open-panel") !== -1 ? true : null; + }, [elem], intern.config.WAIT_TIMEOUT, intern.config.POLL_INTERVAL); + }) .end(); } @@ -61,16 +63,18 @@ define(["intern", assert.isTrue(displayed, "This button should be visible"); }) .end() - .findById(panel) .findByCssSelector(".d-panel-content") .getAttribute("class") .then(function (classes) { assert.isTrue(checkHasNotClass(classes, "d-accordion-open-panel"), "The content of this panel should not be visible"); }) - .then(pollUntil(function (value) { - return document.getElementById(value).style.display === "none"; - }, [panel], intern.config.WAIT_TIMEOUT, intern.config.POLL_INTERVAL)) + .execute("return document.getElementById(" + panel + ")") + .then(function (elem) { + pollUntil(function (value) { + return value.style.display === "none" ? false : null; + }, [elem], intern.config.WAIT_TIMEOUT, intern.config.POLL_INTERVAL); + }) .end(); }