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
11 changed files
with
243 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
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 @@ | ||
{ | ||
"name": "test", | ||
|
||
"requires" : | ||
[ | ||
"../" | ||
] | ||
} |
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,30 @@ | ||
|
||
@task | ||
def source(): | ||
"""Generates source (development) version of test runner""" | ||
core.test_source() | ||
|
||
@task | ||
def build(): | ||
"""Generates build (deployment) version of test runner""" | ||
core.test_build() | ||
|
||
@task | ||
def clean(): | ||
"""Cleans up project environment""" | ||
|
||
session.clean() | ||
Repository.clean() | ||
|
||
@task | ||
def distclean(): | ||
"""Cleans up project environment with removing all non-repository files""" | ||
|
||
session.clean() | ||
Repository.distclean() | ||
|
||
@task | ||
def test(target="source", tool="phantom", browsers=None): | ||
"""Automatically executes tests in either PhantomJS, NodeJS or Testem CI""" | ||
|
||
core.test(target, tool, browsers) |
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,6 @@ | ||
core.Module("test.Kernel", | ||
{ | ||
init : function() { | ||
core.io.Script.load("script/test-" + jasy.Env.getId() + ".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,2 @@ | ||
/** #require(test.*) */ | ||
core.testrunner.Controller.run(); |
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,10 @@ | ||
|
||
if (jasy.Env.isSet("runtime", "browser")) | ||
{ | ||
var suite = new core.testrunner.Suite("bom/Uri"); | ||
|
||
suite.test("Basics", function() | ||
{ | ||
this.isIdentical(typeof unify.bom.Uri, "object"); | ||
}); | ||
} |
Empty file.
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,148 @@ | ||
|
||
if (jasy.Env.isSet("runtime", "browser")) | ||
{ | ||
var suite = new core.testrunner.Suite("theme/Theme"); | ||
|
||
|
||
suite.test("test for class", function() | ||
{ | ||
this.isTrue(!!(new unify.theme.Theme({}) ), "Class is available" ); | ||
}); | ||
|
||
suite.test("theme name", function() { | ||
var t = new unify.theme.Theme({ | ||
name: "Testname" | ||
}); | ||
this.isEqual(t.name(), "Testname", "Theme has name Testname"); | ||
}); | ||
|
||
suite.test("colors", function() { | ||
var t = new unify.theme.Theme({ | ||
colors: { | ||
color1: "#ff0000", | ||
color2: "green" | ||
} | ||
}); | ||
this.isEqual(t.resolveColor("color1"), "#ff0000", "Color1 is red"); | ||
this.isEqual(t.resolveColor("color2"), "green", "Color2 is green"); | ||
this.isEqual(t.resolveColor("color3"), null, "Color3 is not set"); | ||
}); | ||
|
||
suite.test("fonts", function() { | ||
var t = new unify.theme.Theme({ | ||
fonts: { | ||
font0: {}, | ||
font1: { | ||
family: "sans-serif", | ||
size: 12, | ||
style: "italic", | ||
weight: "bold", | ||
decoration: "underline", | ||
lineHeight: 1.5 | ||
}, | ||
font2: { | ||
family: "Droid", | ||
src: "Droid.ttf" | ||
} | ||
} | ||
}); | ||
var font0 = t.resolveFont("font0"); | ||
this.isEqual(font0.fontSize, "16px", "Size of font0 is 16px per default"); | ||
this.isEqual(font0.fontStyle, "normal", "Style of font0 is normal per default"); | ||
this.isEqual(font0.fontWeight, "normal", "Weight of font0 is normal per default"); | ||
this.isEqual(font0.textDecoration, "none", "Text decoration of font0 is none per default"); | ||
this.isEqual(font0.lineHeight, 1.0, "Line height of font0 is 1.0 per default"); | ||
this.isEqual(font0.fontObject, null, "Font object of font0"); | ||
|
||
var font1 = t.resolveFont("font1"); | ||
this.isEqual(font1.fontFamily, "sans-serif", "Font family of font1"); | ||
this.isEqual(font1.fontSize, "12px", "Size of font1"); | ||
this.isEqual(font1.fontStyle, "italic", "Style of font1"); | ||
this.isEqual(font1.fontWeight, "bold", "Weight of font1"); | ||
this.isEqual(font1.textDecoration, "underline", "Text decoration of font1"); | ||
this.isEqual(font1.lineHeight, 1.5, "Line height of font1"); | ||
|
||
var font2 = t.resolveFont("font2"); | ||
this.isEqual(font2.fontFamily, "Droid", "Font family of font2"); | ||
this.isEqual(font0.fontSize, "16px", "Size of font2"); | ||
this.isEqual(font0.fontStyle, "normal", "Style of font2"); | ||
this.isEqual(font0.fontWeight, "normal", "Weight of font2"); | ||
this.isEqual(font0.textDecoration, "none", "Text decoration of font2"); | ||
this.isEqual(font0.lineHeight, 1.0, "Line height of font2"); | ||
|
||
this.isNull(t.resolveFont("font3"),"font3 is not set"); | ||
}); | ||
|
||
suite.test("styles", function() { | ||
var t = new unify.theme.Theme({ | ||
styles: { | ||
"a" : { | ||
style : function(state) { | ||
return { | ||
a : true | ||
}; | ||
} | ||
}, | ||
"b" : { | ||
include : "a" | ||
}, | ||
"c" : { | ||
include : "b", | ||
style : function(state) { | ||
return { | ||
c : true | ||
}; | ||
} | ||
}, | ||
"d" : { | ||
style : function(state) { | ||
return { | ||
d : true | ||
}; | ||
} | ||
}, | ||
"e": "a" | ||
} | ||
}); | ||
|
||
this.isEqual(t.resolveStyle("a").a, true, "Appearance a style a"); | ||
this.isEqual(t.resolveStyle("b").a, true, "Appearance b style a"); | ||
this.isEqual(t.resolveStyle("c").a, true, "Appearance c style a"); | ||
this.isEqual(t.resolveStyle("c").c, true, "Appearance c style c"); | ||
this.isEqual(t.resolveStyle("d").d, true, "Appearance d style d"); | ||
this.isEqual(t.resolveStyle("e").a, true, "Appearance e style a"); | ||
this.isEqual(t.resolveStyle("z"), null, "Appearance z is null"); | ||
}); | ||
|
||
suite.test("inherited styles", function() { | ||
var t1 = new unify.theme.Theme({ | ||
styles: { | ||
"a" : { | ||
style : function(state) { | ||
return { | ||
a1 : true, | ||
a3 : "1" | ||
}; | ||
} | ||
} | ||
} | ||
}); | ||
var t2 = new unify.theme.Theme({ | ||
include: t1, | ||
styles: { | ||
"a" : { | ||
style : function(state) { | ||
return { | ||
a2 : true, | ||
a3 : "2" | ||
}; | ||
} | ||
} | ||
} | ||
}); | ||
|
||
this.isEqual(t2.resolveStyle("a").a1, true, "Appearance a style a1"); | ||
this.isEqual(t2.resolveStyle("a").a2, true, "Appearance a style a2"); | ||
this.isEqual(t2.resolveStyle("a").a3, "2", "Appearance a style a3"); | ||
}); | ||
} |
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>Core - Test Suite</title> | ||
</head> | ||
<body> | ||
<script src="script/kernel.js"></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,4 @@ | ||
#!/usr/bin/env node | ||
|
||
eval(require("fs").readFileSync("script/kernel.js", "utf-8")); | ||
core.io.Script.load("script/test-" + jasy.Env.CHECKSUM + ".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,20 @@ | ||
#!/usr/bin/env phantomjs | ||
|
||
var page = require("webpage").create(); | ||
|
||
page.onConsoleMessage = function(msg) { | ||
console.log(msg); | ||
}; | ||
|
||
page.onAlert = function(msg) { | ||
console.warn("Alert: " + msg); | ||
}; | ||
|
||
page.onCallback = function(data) | ||
{ | ||
if (data.action == "finished") { | ||
phantom.exit(data.status ? 0 : 1); | ||
} | ||
}; | ||
|
||
page.open("index.html"); |