手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >Riot.js 快速的JavaScript单元测试框架
Riot.js 快速的JavaScript单元测试框架
摘要:http://github.com/alexyoung/riotjs示例:Ruby代码复制代码代码如下:context"anewuser"d...

http://github.com/alexyoung/riotjs

示例:

Ruby代码

复制代码 代码如下:

context "a new user" do

setup { User.new }

asserts("that it is not yet created") { topic.new_record? }

end

context "a new user" do

setup { User.new }

asserts("that it is not yet created") { topic.new_record? }

end

Javascript代码

复制代码 代码如下:

Riot.run(function() {

context('basic riot functionality', function() {

given('some simple equality tests', function() {

asserts('a simple truth test should return true', true).isTrue();

asserts('isNull is null', null).isNull();

});

given('another context', function() {

asserts('equals should compare strings as expected', 'test string').equals('test string');

});

given('a context concerned with functions', function() {

asserts('asserts() should allow functions to be compared', function() {

return 'test string';

}).equals('test string');

});

});

given('yet another context', function() {

asserts('equals should compare strings as expected', 'test string').equals('test string');

});

});

【Riot.js 快速的JavaScript单元测试框架】相关文章:

JavaScript对表格或元素按文本,数字或日期排序的方法

javascript事件冒泡实例分析

javascript中DOM复选框选择用法实例

javascript实现查找数组中最大值方法汇总

javascript去除空格方法小结

JavaScript的Backbone.js框架的一些使用建议整理

JavaScript中关联原型链属性特性

深入理解JavaScript的React框架的原理

JavaScript常用数组算法小结

javascript中动态函数用法

精品推荐
分类导航