File tree Expand file tree Collapse file tree
packages/angular-html-parser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ export function parseXml(input: string) {
9797
9898// For prettier
9999export { TagContentType } from "../../compiler/src/ml_parser/tags.ts" ;
100+ export { TokenType } from "../../compiler/src/ml_parser/tokens.ts" ;
100101export {
101102 RecursiveVisitor ,
102103 visitAll ,
@@ -111,6 +112,7 @@ export { SUPPORTED_BLOCKS as SUPPORTED_ANGULAR_BLOCKS } from "../../compiler/src
111112
112113// Types
113114export type { ParseTreeResult } from "../../compiler/src/ml_parser/parser.ts" ;
115+ export type * as Tokens from "../../compiler/src/ml_parser/tokens.ts" ;
114116export type * as Ast from "../../compiler/src/ml_parser/ast.ts" ;
115117
116118// Remove these alias in next major release
Original file line number Diff line number Diff line change 11import { describe , it , expect } from "vitest" ;
2- import { parse , TagContentType } from "../src/index.ts" ;
2+ import { parse , TagContentType , TokenType } from "../src/index.ts" ;
33import { humanizeDom } from "../../compiler/test/ml_parser/ast_spec_utils.ts" ;
44import * as ast from "../../compiler/src/ml_parser/ast.ts" ;
55
@@ -286,3 +286,15 @@ it("Edge cases", () => {
286286 [ ast . Element , ":html:style" , 0 ] ,
287287 ] ) ;
288288} ) ;
289+
290+ describe ( "public token API" , ( ) => {
291+ it ( "should expose TokenType" , ( ) => {
292+ const node = parse ( '{{ "}}" }}' ) . rootNodes [ 0 ] as ast . Text ;
293+ expect ( node ) . toBeInstanceOf ( ast . Text ) ;
294+
295+ const token = node . tokens . find (
296+ ( { type } ) => type === TokenType . INTERPOLATION ,
297+ ) ! ;
298+ expect ( token . parts ) . toEqual ( [ "{{" , ' "}}" ' , "}}" ] ) ;
299+ } ) ;
300+ } ) ;
You can’t perform that action at this time.
0 commit comments