-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add element parts, startTag & endTag #1553
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,29 @@ test('html elements', () => { | |
} | ||
}); | ||
|
||
test('html elements with paths', () => { | ||
let ast = parse(` | ||
<Foo as |bar|> | ||
<bar.x.y class='bar'/> | ||
<bar.x.y class='bar'></bar.x.y> | ||
</Foo> | ||
`); | ||
|
||
let [, foo] = ast.body; | ||
locEqual(foo, 2, 4, 5, 10, 'Foo element'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this range right? 4 to 10 is 6, but the element is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the end is at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the range of 6 though? feels ... arbitrary? I'm probably missing something though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. start: line 2, column 4 different line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol oops. thanks |
||
if (assertNodeType(foo, 'ElementNode')) { | ||
locEqual(foo.startTag, 2, 4, 2, 18, 'Foo start tag'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 18-4 = 14 nice |
||
locEqual(foo.nameNode, 2, 5, 2, 8, 'Foo name node'); | ||
locEqual(foo.endTag, 5, 4, 5, 10, 'Foo end tag'); | ||
let [, barSelfClosed] = foo.children; | ||
if (assertNodeType(barSelfClosed, 'ElementNode')) { | ||
locEqual(barSelfClosed.parts[0], 3, 7, 3, 10, 'bar.x.y bar part'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do each of these have their part name attached? if so, it would be good to assert that as well. |
||
locEqual(barSelfClosed.parts[1], 3, 11, 3, 12, 'bar.x.y x part'); | ||
locEqual(barSelfClosed.parts[2], 3, 13, 3, 14, 'bar.x.y y part'); | ||
} | ||
} | ||
}); | ||
|
||
test('html elements with nested blocks', (assert) => { | ||
let ast = parse(` | ||
<div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful, thank you!