Skip to content

Commit

Permalink
Fixed accordion sample after changes on store
Browse files Browse the repository at this point in the history
- Updating sample according to 11a4c8d
- Optimizing functional test
  • Loading branch information
EAlexRojas authored and Youcef Mammar committed Aug 28, 2015
1 parent 46eb340 commit 09c7ad1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
25 changes: 11 additions & 14 deletions samples/Accordion.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,18 +51,6 @@
</style>
</head>
<body style="display:none">
<d-store id="store">
{"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"}
</d-store>
<d-linear-layout vertical="false">
<div style="width:30%;">
<d-linear-layout id="left" style="position: absolute; width: 100%; height: 100%;">
Expand Down Expand Up @@ -94,7 +81,17 @@ <h2>Third content</h2>
</ul>
</d-panel>
<d-panel label="Fourth Header" id="fourth">
<d-list id="list" store="store">
<d-list id="list">
{"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"}
</d-list>
</d-panel>
</d-accordion>
Expand Down
24 changes: 14 additions & 10 deletions tests/functional/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand Down

0 comments on commit 09c7ad1

Please sign in to comment.