aboutsummaryrefslogtreecommitdiffstats
path: root/docs/spec/domSpec.js
blob: 3fda656fc9fde1d5144328cdaa5cbbf9f3965b5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var DOM = require('dom.js').DOM;

describe('dom', function(){
  var dom;

  beforeEach(function(){
    dom = new DOM();
  });

  describe('h', function(){

    it('should render using function', function(){
      var cbThis;
      var cdValue;
      dom.h('heading', 'content', function(value){
        cbThis = this;
        cbValue = value;
      });
      expect(cbThis).toEqual(dom);
      expect(cbValue).toEqual('content');
    });

    it('should update heading numbers', function(){
      dom.h('heading', function(){
        this.html('<h1>sub-heading</h1>');
      });
      expect(dom.toString()).toContain('<h1>heading</h1>');
      expect(dom.toString()).toContain('<h2>sub-heading</h2>');
    });

  });

});