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 ...
随机推荐
- HDU 1030 数学题
给出两点,求这两点在图上的最短路径 分别以最上,左下,右下为顶点,看这个三角图形 ans=这三种情况下两点的层数差 #include "stdio.h" #include &quo ...
- PS如何绘制虚线圆
1 绘制一个圆的路径 2 选择铅笔工具,然后点击"画笔笔尖形状",选好笔尖的直径和间距(不同的直径对应不同的间距,没有标准数值,自己推拉滑动条就可以了) 3 在路径选项卡, ...
- 利用vue-cli配合vue-router搭建一个完整的spa流程
好文章备忘录: 转自:https://segmentfault.com/a/1190000009160934?_ea=1849098 demo源码:https://github.com/1590123 ...
- ie 代理设置中地址和端口置灰的解决办法
@echo offecho 代理设置reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings&quo ...
- tyvj 1013 找啊找啊找GF
题目大意: 有一个背包,里面的东西需要满足两个条件,不只是体积 求最多能装多少东西,这些东西的东西最小价值 思路: 双重背包 开两个数组,记录装的东西数量和价值 #include<iostrea ...
- BZOJ_2424_[HAOI2010]订货_最小费用最大流
BZOJ_2424_[HAOI2010]订货_最小费用最大流 Description 某公司估计市场在第i个月对某产品的需求量为Ui,已知在第i月该产品的订货单价为di,上个月月底未销完的单位产品要付 ...
- 7 Worksheet 对象
7.1 设置阶段 代码清单7.1:使用Parent属性获得一个对象的父对象的指针 '使用Parent属性获得一个对象的父对象的指针 Sub MeetMySingleParent() 'Declare ...
- Rails 插入代码与注释
醉了醉了,在原来那个表格最后加了然后更新博客,然后最后写的内容就没了.来来回回试了n次都一样.不得已新开一个 插入代码 <% ... %> 打印值 <%= ... %&g ...
- MongoDB Built-In Roles(内置角色)
1. 数据库用户角色:read.readWrite; 2. 数据库管理角色:dbAdmin.dbOwner.userAdmin: 3. 集群管理角色:clusterAdmin.clusterManag ...
- 报错:ERROR! The server quit without updating PID file (/usr/local/var/mysql/chenyuntekiMacBook-Air.local.pid).
在Mac上通过brew install mysql 安装了完mysql 执行mysql.server start 报错:ERROR! The server quit without updating ...