enzyme之shallow渲染

2016-11-14
阅读 2 分钟
7.1k
shallow rendering可以把组件当做一个单元来测试,而且确保不会因为子组件的行为而直接出现断言(Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure that your tests aren't indirectly asserting on behavior of child components.)

enzyme简介——Airbnb的React测试框架

2016-11-14
阅读 3 分钟
5.7k
Enzyme是一个React的JavaScript测试工具,使React组件的输出更加容易extrapolate 。Enzyme的API和jQuery操作DOM一样灵活易用。(因为其使用的是cheerio库来解析虚拟DOM,而cheerio的目标则是做服务器端的jQuery)Enzyme兼容大多数断言库和测试框架,如chai、mocha、jasmine等。

Sequelize Model 使用

2016-10-08
阅读 3 分钟
2.5k
数据检索 查询特定元素 findOne findById {代码...} findOrCreate findAndCountAll findAll {代码...}

Sequelize Model

2016-10-08
阅读 11 分钟
6k
定义Model {代码...} 就像mongoose里定义一样 {代码...} 数据类型 {代码...} 范围类型 {代码...} 特例 {代码...} 推迟 {代码...} Getters & setters 两种方式定义: 作为属性的一部分 {代码...} 作为model选项的一部分 {代码...} Validations验证 {代码...} 错误信息 {代码...} 或 {代码...} 数据同步 {代码...} Mod...

Underscore源码中文注释(转)

2015-10-07
阅读 40 分钟
3.5k
// Underscore.js 1.3.3 // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore is freely distributable under the MIT license. // Portions of Underscore are inspired or borrowed from Prototype, // Oliver Steele's Functional, and John Resig's Micro-Templating. // For all details and docu...

jsPlumb(4)-元素拖放

2015-10-07
阅读 1 分钟
10.7k
使用jsPlumb的一个普通的特性就是元素的拖放。方法如下:myInstanceOfJsPlumb.draggable("elementId");

jsPlumb(3)-基本概念

2015-10-07
阅读 2 分钟
6.8k
Endpoint Connection的可视的一个端点,你可以创建和连接它们,当然,首先你得使它们能拖放。或者通过程序上jsPlumb.connect(...)来创建和连接。更多信息,请访问 the page

jsPlumb(2)-配置

2015-10-07
阅读 2 分钟
8.3k
感受jsPlumb最容易最直观是重写jsPlumb的默认配置。如果你没这么做,你不得不每次调用都得重写这些值。connect和addEndpoint的每个参数都和jsPlumb的默认值有关。

jsPlumb(1) - 开始使用

2015-10-07
阅读 4 分钟
22.6k
jsPlumb默认是注册在浏览器的窗口(window)的,为整个页面提供静态实例。你也可以单独实例化,使用getInstance 模块,例如