aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-table-mode/t/tablemode.vim
blob: 132c4bbb56d53293fd55d23e5b6facc740cdacba (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
" vim: fdm=indent
source t/config/options.vim

describe 'tablemode'
  describe 'Activation'
    describe 'tablemode#Enable()'
      before
        call tablemode#Enable()
      end

      it 'should enable table mode'
        Expect b:table_mode_active to_be_true
      end
    end

    describe 'tablemode#Disable()'
      before
        call tablemode#Disable()
      end

      it 'should disable table mode'
        Expect b:table_mode_active to_be_false
      end
    end

    describe 'tablemode#Toggle()'
      it 'should toggle table mode'
        call tablemode#Toggle()
        Expect b:table_mode_active to_be_true
        call tablemode#Toggle()
        Expect b:table_mode_active to_be_false
      end
    end
  end

  describe 'Tableize'
    before
      new
      read t/fixtures/tableize.txt
    end

    it 'should tableize with default delimiter'
      :2,3call tablemode#TableizeRange('')
      Expect tablemode#table#IsRow(2) to_be_true
      Expect tablemode#spreadsheet#RowCount(2) == 2
      Expect tablemode#spreadsheet#ColumnCount(2) == 3
    end

    it 'should tableize with given delimiter'
      :2,3call tablemode#TableizeRange('/;')
      Expect tablemode#table#IsRow(2) to_be_true
      Expect tablemode#spreadsheet#RowCount(2) == 2
      Expect tablemode#spreadsheet#ColumnCount(2) == 2
    end
  end
end