Permalink
Browse files

support unit-test in nodejs

  • Loading branch information...
1 parent 30487bd commit fed50c8497225b9e8fc0098491514bbf5d12e7dd @yiminghe yiminghe committed Nov 13, 2012
View
@@ -1,6 +1,6 @@
/*
Copyright 2012, KISSY UI Library v1.40dev
MIT Licensed
-build time: Nov 9 16:14
+build time: Nov 13 13:58
*/
-KISSY.add("json",function(c,a){a=a||window.JSON;return c.JSON={parse:function(b){return null==b||""===b?null:a.parse(b)},stringify:a.stringify}},{requires:[KISSY.Features.isNativeJSONSupported?"empty":"json/json2"]});
+KISSY.add("json",function(c,a){"undefined"!==typeof JSON&&(a=JSON);return c.JSON={parse:function(b){return null==b||""===b?null:a.parse(b)},stringify:a.stringify}},{requires:[KISSY.Features.isNativeJSONSupported?"empty":"json/json2"]});
View
@@ -1,15 +1,17 @@
/*
Copyright 2012, KISSY UI Library v1.40dev
MIT Licensed
-build time: Nov 9 16:14
+build time: Nov 13 13:58
*/
/**
* @ignore
* @fileOverview kissy json use json2 or native conditionally
*/
-KISSY.add('json', function (S, JSON) {
+KISSY.add('json', function (S, J) {
- JSON = JSON || window.JSON;
+ if (typeof JSON !== 'undefined') {
+ J = JSON;
+ }
/**
* Provide json utils for KISSY.
@@ -28,15 +30,15 @@ KISSY.add('json', function (S, JSON) {
if (text == null || text === '') {
return null;
}
- return JSON.parse(text);
+ return J.parse(text);
},
/**
* serialize json object to string.
* @method
* @param {Object} jsonObject
* @return {String}
*/
- stringify: JSON.stringify
+ stringify: J.stringify
};
}, {
requires: [
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,11 @@
/*
Copyright 2012, KISSY UI Library v1.40dev
MIT Licensed
+build time: Nov 13 13:58
+*/
+/*
+Copyright 2012, KISSY UI Library v1.40dev
+MIT Licensed
build time: Nov 9 16:14
*/
/*
View
@@ -33,6 +33,10 @@
"jsdom": ">=0.2.0",
"js-beautify": ">=0.2.0"
},
+ "devDependencies": {
+ "walkdir": ">0.0.4",
+ "jasmine-reporters": ">0.2"
+ },
"licenses": [
{
"type": "MIT",
View
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="base" errors="0" tests="5" failures="0" time="0.019" timestamp="2012-11-13T16:08:49">
+ <testcase classname="base" name="拥有 S.EventTarget 上的方法" time="0.002"></testcase>
+ <testcase classname="base" name="拥有 S.Attribute 上的方法" time="0.002"></testcase>
+ <testcase classname="base" name="能解析 ATTRS 和 config" time="0"></testcase>
+ <testcase classname="base" name="能正确触发 S.Attribute 的事件" time="0.004"></testcase>
+ <testcase classname="base" name="transfer default value to value" time="0.001"></testcase>
+</testsuite>
+</testsuites>
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="base_complex" errors="0" tests="8" failures="0" time="0.005" timestamp="2012-11-13T16:08:49">
+ <testcase classname="base_complex" name="can merge property value object from parent class" time="0"></testcase>
+ <testcase classname="base_complex" name="support validator" time="0"></testcase>
+ <testcase classname="base_complex" name="support validators" time="0.001"></testcase>
+ <testcase classname="base_complex" name="support sub attribute name" time="0.001"></testcase>
+ <testcase classname="base_complex" name="set sub attr even if not exist attr" time="0"></testcase>
+ <testcase classname="base_complex" name="set sub attr differently if declared previously" time="0"></testcase>
+ <testcase classname="base_complex" name="validator works for subAttrs" time="0.001"></testcase>
+ <testcase classname="base_complex" name="should fire *Change once for set({})" time="0.002"></testcase>
+</testsuite>
+</testsuites>
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="htmlparser_for_editor" errors="0" tests="7" failures="0" time="0.024" timestamp="2012-11-13T16:08:49">
+ <testcase classname="htmlparser_for_editor" name="can filter elementNames" time="0.001"></testcase>
+ <testcase classname="htmlparser_for_editor" name="can filter imagedata in vml@ie" time="0.012"></testcase>
+ <testcase classname="htmlparser_for_editor" name="can filter attribute" time="0.005"></testcase>
+ <testcase classname="htmlparser_for_editor" name="can modify html structure on fly" time="0.001"></testcase>
+ <testcase classname="htmlparser_for_editor" name="filter children works while modify html" time="0"></testcase>
+ <testcase classname="htmlparser_for_editor" name="filter will run only once" time="0.003"></testcase>
+ <testcase classname="htmlparser_for_editor" name="can filter attributeNames" time="0.002"></testcase>
+</testsuite>
+</testsuites>
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="htmlparser_lexer" errors="0" tests="4" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="htmlparser_lexer" name="works" time="0"></testcase>
+ <testcase classname="htmlparser_lexer" name="works for isSelfClosed" time="0.001"></testcase>
+ <testcase classname="htmlparser_lexer" name="works for &lt;br/&gt;" time="0"></testcase>
+ <testcase classname="htmlparser_lexer" name="works when encounter invalid attribute value" time="0"></testcase>
+</testsuite>
+</testsuites>
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="htmlparser_parser" errors="0" tests="10" failures="0" time="0.006" timestamp="2012-11-13T16:08:49">
+ <testcase classname="htmlparser_parser" name="works for valid html" time="0"></testcase>
+ <testcase classname="htmlparser_parser" name="works for none-valid html" time="0.001"></testcase>
+ <testcase classname="htmlparser_parser" name="works for valid script" time="0.001"></testcase>
+ <testcase classname="htmlparser_parser" name="works for none-valid script" time="0"></testcase>
+ <testcase classname="htmlparser_parser" name="works for non-valid nest tag soup" time="0"></testcase>
+ <testcase classname="htmlparser_parser" name="adjust non-valid nest tag soup by dtd" time="0.001"></testcase>
+ <testcase classname="htmlparser_parser" name="adjust non-valid nest tag soup by dtd and auto paragraph" time="0"></testcase>
+ <testcase classname="htmlparser_parser" name="filterChildren should works" time="0.001"></testcase>
+ <testcase classname="htmlparser_parser" name="can replace text" time="0"></testcase>
+ <testcase classname="htmlparser_parser" name="should parse nested li" time="0.002"></testcase>
+</testsuite>
+<testsuite name="htmlparser_parser.writer" errors="0" tests="1" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="htmlparser_parser.writer" name="works for empty attribute" time="0"></testcase>
+</testsuite>
+</testsuites>
View
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="json" errors="0" tests="0" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+</testsuite>
+<testsuite name="json.stringify" errors="0" tests="1" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="json.stringify" name="should convert an arbitrary value to a JSON string representation" time="0"></testcase>
+</testsuite>
+<testsuite name="json.parse" errors="0" tests="1" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="json.parse" name="should parse a JSON string to the native JavaScript representation" time="0.001"></testcase>
+</testsuite>
+</testsuites>
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="kison" errors="0" tests="7" failures="0" time="0.186" timestamp="2012-11-13T16:08:48">
+ <testcase classname="kison" name="escape correctly" time="0.001"></testcase>
+ <testcase classname="kison" name="generate goto map ok" time="0.038"></testcase>
+ <testcase classname="kison" name="generate table ok" time="0.021"></testcase>
+ <testcase classname="kison" name="parse ok" time="0.02"></testcase>
+ <testcase classname="kison" name="can not parse invalid input" time="0.029"></testcase>
+ <testcase classname="kison" name="can not parse invalid input in compress mode" time="0.03"></testcase>
+ <testcase classname="kison" name="parse ok with action" time="0.022"></testcase>
+</testsuite>
+<testsuite name="kison.state" errors="0" tests="3" failures="0" time="0.025" timestamp="2012-11-13T16:08:49">
+ <testcase classname="kison.state" name="can parse" time="0.006"></testcase>
+ <testcase classname="kison.state" name="can not parse" time="0.007"></testcase>
+ <testcase classname="kison.state" name="can not parse when compress" time="0.012"></testcase>
+</testsuite>
+</testsuites>
View
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="template" errors="0" tests="4" failures="0" time="0.008" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template" name="slash and quote should be escaped" time="0"></testcase>
+ <testcase classname="template" name="should also support @" time="0.001"></testcase>
+ <testcase classname="template" name="should ignore undefined variable" time="0"></testcase>
+ <testcase classname="template" name="should support undefined variable in object" time="0.001"></testcase>
+</testsuite>
+<testsuite name="template.variable" errors="0" tests="2" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.variable" name="should render a normal string" time="0"></testcase>
+ <testcase classname="template.variable" name="should render a normal variable" time="0"></testcase>
+</testsuite>
+<testsuite name="template.statement" errors="0" tests="0" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+</testsuite>
+<testsuite name="template.statement.if" errors="0" tests="1" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.statement.if" name="support if statement" time="0.001"></testcase>
+</testsuite>
+<testsuite name="template.statement.else" errors="0" tests="1" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.statement.else" name="support else statement" time="0.001"></testcase>
+</testsuite>
+<testsuite name="template.statement.elseif" errors="0" tests="1" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.statement.elseif" name="support elseif statement" time="0"></testcase>
+</testsuite>
+<testsuite name="template.statement.each" errors="0" tests="2" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.statement.each" name="support each function" time="0.001"></testcase>
+ <testcase classname="template.statement.each" name="support custom value, index" time="0"></testcase>
+</testsuite>
+<testsuite name="template.cache" errors="0" tests="1" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.cache" name="have template cache" time="0"></testcase>
+</testsuite>
+<testsuite name="template.error" errors="0" tests="1" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.error" name="can handle syntax template error" time="0.001"></testcase>
+</testsuite>
+<testsuite name="template.log" errors="0" tests="1" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.log" name="can log all compiled template code" time="0"></testcase>
+</testsuite>
+<testsuite name="template.comments" errors="0" tests="1" failures="0" time="0" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.comments" name="supports comments" time="0"></testcase>
+</testsuite>
+<testsuite name="template.nested" errors="0" tests="2" failures="0" time="0.001" timestamp="2012-11-13T16:08:49">
+ <testcase classname="template.nested" name="supports nested" time="0.001"></testcase>
+ <testcase classname="template.nested" name="supports nested with different each variable name" time="0"></testcase>
+</testsuite>
+</testsuites>
View
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuites>
+<testsuite name="xtemplate" errors="0" tests="0" failures="0" time="0" timestamp="2012-11-13T16:08:48">
+</testsuite>
+<testsuite name="xtemplate.feature" errors="0" tests="6" failures="0" time="0.054" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature" name="support {{variable}}" time="0.004"></testcase>
+ <testcase classname="xtemplate.feature" name="support function as template" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature" name="support cache" time="0"></testcase>
+ <testcase classname="xtemplate.feature" name="support {{#if}}" time="0.005"></testcase>
+ <testcase classname="xtemplate.feature" name="support comment" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature" name="support set" time="0.001"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.each" errors="0" tests="3" failures="0" time="0.01" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.each" name="support object" time="0.007"></testcase>
+ <testcase classname="xtemplate.feature.each" name="support simple array" time="0.002"></testcase>
+ <testcase classname="xtemplate.feature.each" name="support parent scope" time="0.001"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.with" errors="0" tests="2" failures="0" time="0.004" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.with" name="support object" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.with" name="support parent scope" time="0.003"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.escape" errors="0" tests="4" failures="0" time="0.001" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.escape" name="support escape {{" time="0"></testcase>
+ <testcase classname="xtemplate.feature.escape" name="support escape {{ more" time="0"></testcase>
+ <testcase classname="xtemplate.feature.escape" name="support escapeHTML" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.escape" name="support escape &quot;" time="0"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.command" errors="0" tests="4" failures="0" time="0.003" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.command" name="support global command for variable" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.command" name="support global command for block" time="0"></testcase>
+ <testcase classname="xtemplate.feature.command" name="support local command for variable" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.command" name="support local command for block" time="0.001"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.sub template" errors="0" tests="4" failures="0" time="0.002" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.sub template" name="support global sub template as string" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.sub template" name="support global sub template as function" time="0"></testcase>
+ <testcase classname="xtemplate.feature.sub template" name="support local sub template as string" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.sub template" name="support local sub template as function" time="0"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.expression" errors="0" tests="5" failures="0" time="0.019" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.expression" name="support expression for variable" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.expression" name="support expression for variable in string" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.expression" name="support relational expression" time="0.014"></testcase>
+ <testcase classname="xtemplate.feature.expression" name="support relational expression in each" time="0.001"></testcase>
+ <testcase classname="xtemplate.feature.expression" name="support relational expression in with" time="0.002"></testcase>
+</testsuite>
+<testsuite name="xtemplate.feature.support mustache" errors="0" tests="2" failures="0" time="0.003" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.feature.support mustache" name="support object" time="0.002"></testcase>
+ <testcase classname="xtemplate.feature.support mustache" name="support array" time="0.001"></testcase>
+</testsuite>
+<testsuite name="xtemplate.error detection" errors="0" tests="3" failures="0" time="0.002" timestamp="2012-11-13T16:08:48">
+ <testcase classname="xtemplate.error detection" name="detect un-closed block tag" time="0.001"></testcase>
+ <testcase classname="xtemplate.error detection" name="warn about missing property" time="0"></testcase>
+ <testcase classname="xtemplate.error detection" name="detect unmatched" time="0.001"></testcase>
+</testsuite>
+</testsuites>
@@ -3,7 +3,7 @@
* @author yiminghe@gmail.com
*/
KISSY.use("base", function (S, Base) {
- describe("complex base/attribute", function () {
+ describe("base_complex", function () {
it("can merge property value object from parent class", function () {
function a() {
Oops, something went wrong.

0 comments on commit fed50c8

Please sign in to comment.