-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>basis.js base environment</title> | ||
</head> | ||
|
||
<body> | ||
<script src="../src/basis.js" data-basis-config=""></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Test runner setup example (for basis.js-based apps)</title> | ||
</head> | ||
|
||
<body> | ||
<script src="path/to/src/basis.js" basis-config></script> | ||
<script> | ||
if (this.top === this) | ||
location.href = 'runner/reporter.html?page=../index.html'; // page parameter value should contain relative path | ||
// from reporter.html to this page | ||
|
||
(function(){ | ||
var originalJsWrapper = basis.resource.extensions['.js']; | ||
basis.resource.extensions['.js'] = function(content, url){ | ||
var exports = originalJsWrapper(content, url); | ||
if (exports) | ||
exports.filename_ = url; | ||
return exports; | ||
}; | ||
|
||
// page reload on spec files update | ||
// run in next tick, because at code run basisjs-tools file sync | ||
// script is not loaded yet | ||
basis.ready(function(){ | ||
if (typeof basisjsToolsFileSync != 'undefined') | ||
basisjsToolsFileSync.notifications.attach(function(type, filename){ | ||
if (type == 'update' && | ||
basis.resource.exists(filename) && | ||
!/^\.\./.test(basis.path.relative(filename))) | ||
location.reload(); | ||
}); | ||
}); | ||
})(); | ||
|
||
function loadTests(loadTestsToReporter){ | ||
loadTestsToReporter(basis.require('./index.js')); // path to test suite index file | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// example test suite | ||
module.exports = { | ||
name: 'Example test suite', | ||
html: __dirname + 'env.html', // base env | ||
test: [ | ||
require('./spec/suite1.js') | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
name: 'Test suite 1', | ||
test: [ | ||
{ | ||
name: 'Test #1', | ||
test: function(){ | ||
// test code | ||
} | ||
}, | ||
{ | ||
name: 'Test #2', | ||
test: function(){ | ||
// test code | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>basis.js base environment</title> | ||
</head> | ||
|
||
<body> | ||
<script src="../src/basis.js" data-basis-config=""></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Test runner setup example (for non-basis.js-based apps)</title> | ||
</head> | ||
|
||
<body> | ||
<script src="path/to/src/basis.js" basis-config></script> | ||
<script> | ||
if (this.top === this) | ||
location.href = 'runner/reporter.html?page=../index.html'; // page parameter value should contain relative path | ||
// from reporter.html to this page | ||
|
||
function loadTests(loadTestsToReporter){ | ||
loadTestsToReporter({ | ||
name: 'Test suite', | ||
test: [ | ||
{ | ||
name: 'Test #1', | ||
test: function(){ | ||
// test code | ||
} | ||
}, | ||
{ | ||
name: 'Test #2', | ||
test: function(){ | ||
// test code | ||
} | ||
} | ||
] | ||
}); | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |