-
Notifications
You must be signed in to change notification settings - Fork 401
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
fix(engine): marking dynamic nodes as dynamic #810
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const assert = require('assert'); | ||
describe('Dynamic text nodes rendering duplicate text', () => { | ||
const URL = 'http://localhost:4567/duplicate-text-rendering'; | ||
|
||
before(() => { | ||
browser.url(URL); | ||
}); | ||
|
||
it('should not render duplicate text', function () { | ||
browser.click('integration-duplicate-text-rendering'); | ||
assert.notDeepEqual(browser.getText('integration-duplicate-text-rendering'), 'ab'); | ||
assert.deepEqual(browser.getText('integration-duplicate-text-rendering'), 'b'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<template if:true={hasParts}> | ||
<template for:each={text} for:item="part"> | ||
<template if:true={part.highlight}> | ||
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. Can we simplify this by removing 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. Oddly enough, the bug does not exhibit when we remove this condition, 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. |
||
{part.text} | ||
</template> | ||
<template if:false={part.highlight}> | ||
{part.text} | ||
</template> | ||
</template> | ||
</template> | ||
<template if:false={hasParts}> | ||
{text} | ||
</template> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { LightningElement, track } from 'lwc'; | ||
|
||
export default class App extends LightningElement { | ||
@track text = [{ | ||
text: 'a', | ||
highlight: false, | ||
}] | ||
|
||
get hasParts() { | ||
return Array.isArray(this.text) && this.text.length > 0; | ||
} | ||
|
||
get highlight() { | ||
return false | ||
} | ||
|
||
get firstPart() { | ||
return this.text[0] | ||
} | ||
|
||
connectedCallback() { | ||
this.addEventListener('click', () => { | ||
this.text = 'b' | ||
}) | ||
} | ||
|
||
} |
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.
Is it worth adding an
assert.notDeepEqual()
here, or maybe a comment that describes the issue that these changes fix? I'm just curious about what was actually being rendered.