aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/angular_spec.lua
blob: 03ba153afc9ac730d5786a8fe0b8cb40796e49c6 (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
local Runner = require('tests.indent.common').Runner
local runner = Runner:new(it, 'tests/indent/angular', {
  tabstop = 2,
  shiftwidth = 2,
  expandtab = true,
})

describe('indent HTML Angular:', function()
  describe('whole file:', function()
    runner:whole_file('.')
  end)

  describe('new line:', function()
    for _, info in ipairs({
      { 1, 2 },
      { 2, 2 },
      { 3, 2 },
      { 4, 2 },
      { 6, 0 },
      { 7, 2 },
      { 8, 4 },
      { 10, 4 },
      { 11, 6 },
      { 12, 6 },
      { 13, 4 },
      { 14, 2 },
    }) do
      runner:new_line('if-else.html', { on_line = info[1], text = '//', indent = info[2] })
    end

    for _, info in ipairs({
      { 1, 2 },
      { 2, 4 },
      { 3, 6 },
      { 4, 6 },
      { 6, 6 },
      { 7, 6 },
      { 9, 6 },
      { 10, 6 },
      { 12, 2 },
    }) do
      runner:new_line('switch-case.html', { on_line = info[1], text = '//', indent = info[2] })
    end

    for _, info in ipairs({
      { 1, 2 },
      { 2, 2 },
      { 3, 2 },
      { 4, 2 },
      { 5, 0 },
    }) do
      runner:new_line('for.html', { on_line = info[1], text = '//', indent = info[2] })
    end

    for _, info in ipairs({
      { 1, 2 },
      { 2, 2 },
      { 3, 2 },
      { 4, 2 },
      { 5, 2 },
      { 6, 2 },
      { 7, 2 },
      { 8, 2 },
      { 9, 0 },
    }) do
      runner:new_line('defer.html', { on_line = info[1], text = '//', indent = info[2] })
    end
  end)
end)