Skip to content

Commit

Permalink
Upgrade to StealJS 2 & QUnit 2
Browse files Browse the repository at this point in the history
This should fix some stability issues with the tests.
  • Loading branch information
Chasen Le Hara authored and chasenlehara committed Nov 14, 2019
1 parent ef77f86 commit 0273a01
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@
"unescape-html": "^1.0.0"
},
"devDependencies": {
"bit-docs-generate-html": "^0.8.0",
"bit-docs-generate-html": "^0.11.0",
"bit-docs-generate-searchmap": "^0.2.0",
"bit-docs-html-toc": "^0.6.0",
"bit-docs-html-toc": "^1.1.1",
"connect": "^3.5.0",
"funcunit": "^3.4.3",
"http-server": "^0.11.0",
"normalize.css": "^5.0.0",
"q": "^1.4.1",
"steal": "^1.5.9",
"steal": "^2.0.0",
"steal-conditional": "^1.0.0",
"steal-qunit": "^1.0.1",
"steal-tools": "^1.8.2",
"steal-qunit": "^2.0.0",
"steal-tools": "^2.0.0",
"test-saucelabs": "^0.0.6",
"testee": "^0.9.0",
"zombie": "^6.0.0"
Expand Down
47 changes: 27 additions & 20 deletions test/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,36 @@ var indexOfPageInResults = function(pageName, results) {
}
};

/* Clear local storage */
window.localStorage.clear();

/* Render the search templates into the page */
var qunitFixture = document.getElementById('qunit-fixture');
qunitFixture.appendChild(searchBarTemplate());
qunitFixture.appendChild(searchResultsTemplate());

/* Create a new instance of the search control */
var search = new SearchControl('.search-bar', {
pathPrefix: '../doc'
});
var search;
var setUpSearchControl;

/* Tests */
QUnit.module('search control');
QUnit.module('search control', {
before: function() {

/* Clear local storage */
window.localStorage.clear();

/* Render the search templates into the page */
var qunitFixture = document.getElementById('qunit-fixture');
qunitFixture.appendChild(searchBarTemplate());
qunitFixture.appendChild(searchResultsTemplate());

/* Create a new instance of the search control */
search = new SearchControl('.search-bar', {
pathPrefix: '../doc'
});

setUpSearchControl = search.searchEnginePromise.then(function(searchMap) {
return new Promise(function(resolve) {
// Wait for the search worker to be set up
setTimeout(function() {
resolve(searchLogic.indexData(search.convertSearchMapToIndexableItems(searchMap)));
}, 2000);
});
});

var setUpSearchControl = search.searchEnginePromise.then(function(searchMap) {
return new Promise(function(resolve) {
// Wait for the search worker to be set up
setTimeout(function() {
resolve(searchLogic.indexData(search.convertSearchMapToIndexableItems(searchMap)));
}, 2000);
});
}
});

QUnit.test('Search results render', function(assert) {
Expand Down

0 comments on commit 0273a01

Please sign in to comment.