You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
736 B

4 years ago
  1. var assert = require('assert')
  2. var deindent = require('./index')
  3. describe('de-indent', function () {
  4. it('0 indent', function () {
  5. var str = '\nabc\n bcd\n cde\nefg'
  6. var res = deindent(str)
  7. assert.equal(str, res)
  8. })
  9. it('non-0 indent', function () {
  10. var str = ' abc\n bcd\n cde\n efg'
  11. var res = deindent(str)
  12. assert.equal(res, 'abc\n bcd\ncde\n efg')
  13. })
  14. it('tabs', function () {
  15. var str = '\tabc\n\t\tbcd\n\tcde\n\t\tefg'
  16. var res = deindent(str)
  17. assert.equal(res, 'abc\n\tbcd\ncde\n\tefg')
  18. })
  19. it('single line', function () {
  20. var str = '\n <h2 class="red">{{msg}}</h2>\n'
  21. var res = deindent(str)
  22. assert.equal(res, '\n<h2 class="red">{{msg}}</h2>\n')
  23. })
  24. })