treetable adding nodes at root level
describe("loadBranch()", function() { | ||
beforeEach(function() { | ||
this.newRows = "<tr data-tt-id='3' data-tt-parent-id='2'><td>N3</td></tr><tr data-tt-id='4' data-tt-parent-id='2'><td>N4</td></tr>" | ||
- this.moreRows = "<tr data-tt-id='5' data-tt-parent-id='2'><td>N5</td></tr>" | ||
+ this.moreRows = "<tr data-tt-id='5' data-tt-parent-id='2'><td>N5</td></tr>"; | ||
this.subject.treetable(); | ||
this.parentNode = this.subject.treetable("node", 2); | ||
@@ -276,9 +276,32 @@ | ||
expect(this.subject.data("treetable").tree[4]).to.be.defined; | ||
}); | ||
+ it("registers nodes", function() { | ||
+ expect(this.subject.data("treetable").nodes.length).to.equal(3); | ||
+ this.subject.treetable("loadBranch", this.parentNode, this.newRows); | ||
+ expect(this.subject.data("treetable").nodes.length).to.equal(5); | ||
+ }); | ||
+ | ||
it("maintains chainability", function() { | ||
expect(this.subject.treetable("loadBranch", this.parentNode, this.newRows)).to.equal(this.subject); | ||
}); | ||
+ | ||
+ describe("adding nodes at root level", function() { | ||
+ beforeEach(function() { | ||
+ this.rootRows = "<tr data-tt-id='6'><td>N6</td></tr>"; | ||
+ }); | ||
+ | ||
+ it("registers nodes as root nodes", function () { | ||
+ expect(this.subject.data("treetable").roots.length).to.equal(1); | ||
+ this.subject.treetable("loadBranch", null, this.rootRows); | ||
+ expect(this.subject.data("treetable").roots.length).to.equal(2); | ||
+ }); | ||
+ | ||
+ it("inserts rows into DOM", function () { | ||
+ this.subject.treetable("loadBranch", null, this.rootRows); | ||
+ expect($(this.subject[0].rows[3]).data("ttId")).to.equal(6); | ||
+ }); | ||
+ }); | ||
}); | ||
treetable adding nodes at root level的更多相关文章
- logback root level logger level 日志级别覆盖?继承?
1. logback-spring.xml 配置 <appender name="STDOUT" class="ch.qos.logback.core.Consol ...
- Leetcode之深度优先搜索(DFS)专题-1080. 根到叶路径上的不足节点(Insufficient Nodes in Root to Leaf Paths)
Leetcode之深度优先搜索(DFS)专题-1080. 根到叶路径上的不足节点(Insufficient Nodes in Root to Leaf Paths) 这篇是DFS专题的第一篇,所以我会 ...
- C# UTF8的BOM导致XML序列化与反序列化报错:Data at the root level is invalid. Line 1, position 1.
最近在写一个xml序列化及反序列化实现时碰到个问题,大致类似下面的代码: class Program { static void Main1(string[] args) { var test = n ...
- 【leetcode】1080. Insufficient Nodes in Root to Leaf Paths
题目如下: Given the root of a binary tree, consider all root to leaf paths: paths from the root to any l ...
- Data Structure Binary Tree: Connect nodes at same level using constant extra space
http://www.geeksforgeeks.org/connect-nodes-at-same-level-with-o1-extra-space/ recursive: #include &l ...
- C# LoadXml System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
去掉BOM头 writer = new XmlTextWriter(stream, new UnicodeEncoding(false,false)); 如果是UTF8 writer = new Xm ...
- LintCode Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...
- [LeetCode]题解(python):107 Binary Tree Level Order Traversal II
题目来源 https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ Given a binary tree, return ...
- [LeetCode]题解(python):103 Binary Tree Zigzag Level Order Traversal
题目来源 https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ Given a binary tree, re ...
随机推荐
- web前端减少你按刷新的频率
Browsersync 先下载:nodejs ,然后安装完以后,我们在命令行打印 node -v 完成后我们进行以下操作,安装browser-sync ,官网上有详细的教程,请访问:Browsers ...
- VB.NET+三层 机房收费系统之组合查询
关系组合查询已经用去了4天的时间.每天都在痛苦中煎熬,绞尽脑汁,一句代码都要瞪大眼睛看好长时间,有时候.由于两句话颠倒了.就nothing了:有时候,由于table如何可以转换成实体类型.将自己困住了 ...
- 组件的使用(四)DatePickerDialog和TimePickerDialog的使用
这两个组件的使用都须要获得当前日期或时间.实现方法是获得一个Calender实例(调用getInstance()实例化) DatePickerDialog的使用 Calendar calendar=C ...
- MySQL中文參考手冊
非常好的中文手冊: 链接:http://www.sdau.edu.cn/support/mysq_doc/manual_toc.html
- 【跟我一步一步学Struts2】——登陆样例
本篇博客通过一个简单的登陆小样例来入门,简单了解一下struts2是怎样工作的: 第一步引入Jar包: commons-fileupload-1.2.1.jar,文件上传 commons-loggin ...
- HDU4403 A very hard Aoshu problem DFS
A very hard Aoshu problem Time Limit: 2000/1000 MS (Java/Others) Memory ...
- sublime —— 强大的插件
1. 代码 自动补全与智能提示: All Autocomplete:Sublime Text 默认的 Autocomplete 功能只考虑当前的文件,而 All Autocomplete 插件会搜索所 ...
- 830C
分块+二分 这道题思路很巧妙 我们大概可以推出一个式子sigma(d-[(ai-1)%d+1])<=k,要求求出d的最大值 然后我们化简一下,sigma(d-[(ai-1)-[(ai-1)/d] ...
- Enum类的非一般用法汇总(工作中遇到时持续更新)
1. 每个枚举实例定义一套自己的方法示例: 1 @AllArgsConstructor 2 public enum BroadcastTypeEnum { 3 ALL(0, "全站&quo ...
- bzoj 2091: [Poi2010]The Minima Game【博弈论+贪心+dp】
不知道算不算博弈 很妙的贪心,一直在想SG函数结果... 首先从大到小排个序,然后考虑当前的人要怎么选:如果不选最后一段,那么另一人会选,这样不利于当前的人,所以每个人一定会选最后一段 设f[i]为要 ...