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. yarn-cli 简介

    Yarn 提供了丰富的命令行命令来帮你应付你所开发的 Yarn 包的方方面面的工作,包括安装.管理.发布等等. 虽然我们在这里按照字母顺序列出了我们提供的所有命令,但是某些更常用的命令还是要着重提一下 ...

  2. ViewPager学习之仿微信主界面

    由于素材的原因,这里都是从网上找的图片,所以所谓的仿微信实际上最后成了下图这货.. .,点击变色也是自己用的windows自带绘图的颜料桶填充的空白. .. watermark/2/text/aHR0 ...

  3. cocos2d-x 3.0游戏实例学习笔记 《跑酷》 第五步--button控制主角Jump&amp;Crouch

    说明:这里是借鉴:晓风残月前辈的博客.他是将泰然网的跑酷教程,用cocos2d-x 2.X 版本号重写的,眼下我正在学习cocos2d-X3.0 于是就用cocos2d-X 3.0重写,并做相关笔记 ...

  4. 李洪强iOS开发之动态获取UILabel的bounds

    李洪强iOS开发之动态获取UILabel的bounds 在使用UILabel存放字符串时,经常需要获取label的长宽数据,本文列出了部分常用的计算方法. 1.获取宽度,获取字符串不折行单行显示时所需 ...

  5. cesm下载备注

    新版使用svn下载. 软件要求: The following are the external system and software requirements for installing and ...

  6. AVD那些事儿

    启动了AVD却说找不到AVD 错误提示: No active compatible AVD's or devices found. Relaunch this configuration after ...

  7. ps图片怎样实现渐变

    首先我先将一副图片展示给大家: 我所做的效果是想把图片做成渐变.而不改变中间图片的颜色效果. 接下来我来说明一下我的所做思路. 首先将图片中间部分选择出来.然后复制成一个图层. 详细操作是用魔棒进行反 ...

  8. C中 数组和指针的异同

    数组在很多情况下是和指针等价的,数组的下标运算和指针的解引用也有等价形式:arr[i] == *(arr + 1):但是也有一些情况下数组和指针是不一样的:extern int arr[]; exte ...

  9. spi和I2c的速率

    I2C协议v2.1规定了100K,400K和3.4M三种速率(bps).SPI是一种事实标准,由Motorola开发,并没有一个官方标准.已知的有的器件SPI已达到50Mbps.具体到产品中SPI的速 ...

  10. MPEG2、MPEG4、H264的差异

    iso(国际标准化组织) MPEG系列 ITU-T(国际电联)h.系列 H.264:iso与ITU联合制定,数据压缩比超牛! MPEG-2简介 MPEG-2制定于1994年,设计目标是高级工业标准的图 ...