-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
only run create() for new if blocks - fixes #665
- Loading branch information
1 parent
3269ed4
commit de2e059
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
test/runtime/samples/transition-js-if-block-in-each-block-bidi/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
export default { | ||
data: { | ||
threshold: 5 | ||
}, | ||
|
||
html: ` | ||
<div>1</div> | ||
<div>2</div> | ||
<div>3</div> | ||
<div>4</div> | ||
<div>5</div> | ||
`, | ||
|
||
test ( assert, component, target, window, raf ) { | ||
const divs = target.querySelectorAll('div'); | ||
|
||
assert.equal(divs[0].foo, 0); | ||
|
||
raf.tick(100); | ||
assert.equal(divs[0].foo, 1); | ||
|
||
component.set({ threshold: 4 }); | ||
assert.equal( divs[4].foo, 1 ); | ||
|
||
raf.tick( 200 ); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<div>1</div> | ||
<div>2</div> | ||
<div>3</div> | ||
<div>4</div> | ||
`); | ||
|
||
component.set({ threshold: 3 }); | ||
assert.equal( divs[3].foo, 1 ); | ||
|
||
raf.tick( 300 ); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<div>1</div> | ||
<div>2</div> | ||
<div>3</div> | ||
`); | ||
|
||
component.destroy(); | ||
} | ||
}; |
20 changes: 20 additions & 0 deletions
20
test/runtime/samples/transition-js-if-block-in-each-block-bidi/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{#each [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as number}} | ||
{{#if threshold >= number}} | ||
<div transition:foo>{{number}}</div> | ||
{{/if}} | ||
{{/each}} | ||
|
||
<script> | ||
export default { | ||
transitions: { | ||
foo: function ( node ) { | ||
return { | ||
duration: 100, | ||
tick: t => { | ||
node.foo = t; | ||
} | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |