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的更多相关文章

  1. logback root level logger level 日志级别覆盖?继承?

    1. logback-spring.xml 配置 <appender name="STDOUT" class="ch.qos.logback.core.Consol ...

  2. Leetcode之深度优先搜索(DFS)专题-1080. 根到叶路径上的不足节点(Insufficient Nodes in Root to Leaf Paths)

    Leetcode之深度优先搜索(DFS)专题-1080. 根到叶路径上的不足节点(Insufficient Nodes in Root to Leaf Paths) 这篇是DFS专题的第一篇,所以我会 ...

  3. 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 ...

  4. 【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 ...

  5. 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 ...

  6. 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 ...

  7. LintCode Binary Tree Level Order Traversal

    Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, ...

  8. [LeetCode]题解(python):107 Binary Tree Level Order Traversal II

    题目来源 https://leetcode.com/problems/binary-tree-level-order-traversal-ii/ Given a binary tree, return ...

  9. [LeetCode]题解(python):103 Binary Tree Zigzag Level Order Traversal

    题目来源 https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/ Given a binary tree, re ...

随机推荐

  1. 【BLE】CC2541之自己定义长短按键

    本篇博文最后改动时间:2017年01月06日,11:06. 一.简单介绍 本文以SimpleBLEPeripheral为例,介绍怎样将普通IO口(P12)自己定义为长短按键,实现按键3S以内松开为短按 ...

  2. boost::mpl::eval_if的使用方法

    近期看boost的时候总是遇见这个eval_if,不知道啥意思,就没法看下去了,比方 前篇文章boost::serialization 拆分serialize函数分析时就出现这样一段代码: templ ...

  3. android的toogleButton和switch的使用方法

    这两个是button开关.监听CheckedChangeListener toggle_layout.xml: <? xml version="1.0" encoding=& ...

  4. jquery中怎样防止冒泡事件

    jquery中怎样防止冒泡事件 1.利用event.stopPropagation() 2.利用return false 3.利用event.preventDefault()

  5. lambda和委托那点事

    Lambda 简介 Lambda 表达式是一种可用于创建委托或表达式目录树类型的一种匿名函数(匿名方法+Lambda).通过使用 lambda 表达式,可以写入可作为参数传递或作为函数 调用值返回的本 ...

  6. JPA測试实例

    依赖架包 实体 import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.G ...

  7. solr入门之solr的拼写检查功能的应用级别尝试

    今天主要是收集了些拼写检查方面的资料和 尝试使用一下拼写检查的功能--=遇到了不少问题 拼写检查的四种配置眼下我仅仅算是成功了半个吧 --------------------------------- ...

  8. c#控件重绘的问题

    1.当Panel有背景图像的时候,往Panel添加控件(带图像),画面会非常闪烁,所以,Panel尽量不要带背景图像 2.带背景图像可以参考designer.cs里面的写法... 添加Control之 ...

  9. uva10870

    https://vjudge.net/problem/UVA-10870 裸的矩阵快速幂 注意系数矩阵在前面 因为系数矩阵为d*d 方程矩阵为d * 1 放反了就是d * 1 d * d 不符合矩阵乘 ...

  10. Java多线程系列三——实现线程同步的方法

    两种实现线程同步的方法 方法 特性 synchronized 不需要显式地加解锁,易实现 ReentrantLock 需要显式地加解锁,灵活性更好,性能更优秀,结合Condition可实现多种条件锁 ...