/** * @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 '@angular/compiler/src/ml_parser/ast'; import {HtmlParser} from '@angular/compiler/src/ml_parser/html_parser'; import {getHtmlTagDefinition} from '@angular/compiler/src/ml_parser/html_tags'; { describe('Node serializer', () => { let parser: HtmlParser; beforeEach(() => { parser = new HtmlParser(); }); it('should support element', () => { const html = '
'; const ast = parser.parse(html, 'url'); expect(serializeNodes(ast.rootNodes)).toEqual([html]); }); it('should support attributes', () => { const html = ''; const ast = parser.parse(html, 'url'); expect(serializeNodes(ast.rootNodes)).toEqual([html]); }); it('should support text', () => { const html = 'some text'; const ast = parser.parse(html, 'url'); expect(serializeNodes(ast.rootNodes)).toEqual([html]); }); it('should support expansion', () => { const html = '{number, plural, =0 {none} =1 {one} other {many}}'; const ast = parser.parse(html, 'url', true); expect(serializeNodes(ast.rootNodes)).toEqual([html]); }); it('should support comment', () => { const html = ''; const ast = parser.parse(html, 'url', true); expect(serializeNodes(ast.rootNodes)).toEqual([html]); }); it('should support nesting', () => { const html = `{number, plural, =0 {{sex, select, other {?}}}}