/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */
import * as html from '../../src/ml_parser/ast';
import {HtmlParser} from '../../src/ml_parser/html_parser';
import {PRESERVE_WS_ATTR_NAME, removeWhitespaces} from '../../src/ml_parser/html_whitespaces';
import {humanizeDom} from './ast_spec_utils';
{
  describe('removeWhitespaces', () => {
    function parseAndRemoveWS(template: string): any[] {
      return humanizeDom(removeWhitespaces(new HtmlParser().parse(template, 'TestComp')));
    }
    it('should remove blank text nodes', () => {
      expect(parseAndRemoveWS(' ')).toEqual([]);
      expect(parseAndRemoveWS('\n')).toEqual([]);
      expect(parseAndRemoveWS('\t')).toEqual([]);
      expect(parseAndRemoveWS('    \t    \n ')).toEqual([]);
    });
    it('should remove whitespaces (space, tab, new line) between elements', () => {
      expect(parseAndRemoveWS('
  
\t
\n
')).toEqual([
        [html.Element, 'br', 0],
        [html.Element, 'br', 0],
        [html.Element, 'br', 0],
        [html.Element, 'br', 0],
      ]);
    });
    it('should remove whitespaces from child text nodes', () => {
      expect(parseAndRemoveWS('
 elements', () => {
      expect(parseAndRemoveWS(`foo\nbar
`)).toEqual([
        [html.Element, 'pre', 0],
        [html.Element, 'strong', 1],
        [html.Text, 'foo', 2],
        [html.Text, '\n', 1],
        [html.Element, 'strong', 1],
        [html.Text, 'bar', 2],
      ]);
    });
    it('should skip whitespace trimming in