This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.3k
fix(ngRepeat): trigger move animation #15072
Open
pondermatic
wants to merge
11
commits into
angular:master
Choose a base branch
from
pondermatic:ngRepeat-animations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2331c42
fix(ngRepeat): trigger move animation
pondermatic 263be6b
style(ngRepeat) eslint does not like unused functions and requires co…
pondermatic f3c6062
style(ngRepeat): getBlockStart function is no lon
8000
ger needed
pondermatic 47bd3a4
style(ngRepeat): kick off Travis-CI
pondermatic 7a98172
perf(ngRepeat): use less memory and compare less
pondermatic d8320a1
Merge branch 'ngRepeat-animations' of https://github.com/pondermatic/…
pondermatic dcc80c1
Merge branch 'master' into ngRepeat-animations
pondermatic c969ae2
fix(ngRepeat): correctly re-create last block order when track by is …
pondermatic 410312c
test(ngRepeat): Update based on feedback.
pondermatic 4d6feb9
test(ngRepeat): Update based on feedback.
pondermatic 3b17d5d
test(ngRepeat): Add 'toContainQueueItem' Jasmine matcher
pondermatic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(ngRepeat): correctly re-create last block order when track by is …
…an integer Merge changes from Narretz@7dbf428.
- Loading branch information
commit c969ae23c48eab32989435d8ed4f9767e89c5ad4
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
|
@@ -1624,4 +1624,55 @@ describe('ngRepeat animations', function() { | |
expect(item.element.text()).toBe('2'); | ||
}) | ||
); | ||
it('should maintain the order when the track by expression evaluates to an integer', | ||
inject(function($compile, $rootScope, $animate, $document, $sniffer, $timeout) { | ||
if (!$sniffer.transitions) return; | ||
|
||
var item; | ||
var ss = createMockStyleSheet($document); | ||
|
||
var items = [ | ||
{id: 1, name: 'A'}, | ||
{id: 2, name: 'B'}, | ||
{id: 4, name: 'C'}, | ||
{id: 3, name: 'D'} | ||
]; | ||
|
||
try { | ||
|
||
$animate.enabled(true); | ||
|
||
ss.addRule('.animate-me div', | ||
'transition:1s linear all;'); | ||
|
||
element = $compile(html('<div class="animate-me">' + | ||
'<div ng-repeat="item in items track by item.id">{{ item.name }}</div>' + | ||
'</div>'))($rootScope); | ||
|
||
$rootScope.items = [items[0], items[1], items[2]]; | ||
$rootScope.$digest(); | ||
expect(element.text()).toBe('ABC'); | ||
|
||
$rootScope.items.push(items[3]); | ||
$rootScope.$digest(); | ||
|
||
expect(element.text()).toBe('ABCD'); // the original order should be preserved | ||
$animate.flush(); | ||
$timeout.flush(1500); // 1s * 1.5 closing buffer | ||
expect(element.text()).toBe('ABCD'); | ||
|
||
$rootScope.items = [items[0], items[1], items[3]]; | ||
$rootScope.$digest(); | ||
|
||
// The leaving item should maintain it's position until it is removed | ||
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. it's -> its (I know, I added this test ;)) |
||
expect(element.text()).toBe('ABCD'); | ||
$animate.flush(); | ||
$timeout.flush(1500); // 1s * 1.5 closing buffer | ||
expect(element.text()).toBe('ABD'); | ||
|
||
} finally { | ||
ss.destroy(); | ||
} | ||
}) | ||
); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please put a newline between the two
it
s