Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit afa3505

Browse files
committed
test(sortable): add test for firing create() callback on init
1 parent 11b48b0 commit afa3505

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/sortable.e2e.callbacks.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,28 @@ describe('uiSortable', function() {
190190
});
191191
});
192192

193+
it('should call the create() callback when initialized', function() {
194+
inject(function($compile, $rootScope) {
195+
var element;
196+
$rootScope.$apply(function() {
197+
$rootScope.items = ['One', 'Two', 'Three'];
198+
$rootScope.opts = {
199+
create: function() {
200+
201+
}
202+
};
203+
spyOn($rootScope.opts, 'create');
204+
element = $compile('<ul ui-sortable="opts" ng-model="items"><li ng-repeat="item in items" id="s-{{$index}}">{{ item }}</li></ul>')($rootScope);
205+
});
206+
207+
host.append(element);
208+
209+
expect($rootScope.opts.create).toHaveBeenCalled();
210+
211+
$(element).remove();
212+
});
213+
});
214+
193215
});
194216

195217
});

0 commit comments

Comments
 (0)