fix(collectionRepeat): fix rare NPE error on android 4.1

Closes #1292
This commit is contained in:
Andrew Joslin
2014-05-21 07:44:21 -06:00
parent 3618109187
commit 94f0b5b705
4 changed files with 14 additions and 9 deletions

View File

@@ -22,10 +22,12 @@ describe('bar directives', function() {
});
spyOn(ionic, 'off');
var el = setup();
expect(ionic.on).toHaveBeenCalledWith('tap', jasmine.any(Function), el[0]);
expect(ionic.on.mostRecentCall.args[0]).toBe('tap');
expect(ionic.off).not.toHaveBeenCalled();
el.scope().$destroy();
expect(ionic.off).toHaveBeenCalledWith('tap', callback, el[0]);
expect(ionic.off.mostRecentCall.args[0]).toBe('tap');
expect(ionic.off.mostRecentCall.args[1]).toBe(callback);
expect(ionic.off.mostRecentCall.args[2]).toBe(el[0]);
});
['input','textarea','select'].forEach(function(tag) {
it('should ignore tap if it\'s in a ' + tag, function() {

View File

@@ -525,14 +525,17 @@ describe('collectionRepeatManager service', function() {
it('should attachItem and set the element transform', function() {
var manager = setup();
var item = {
element: [{ style: {} }]
element: angular.element('<div>')
};
spyOn(item.element, 'css');
spyOn(manager.dataSource, 'getItem').andReturn(item);
spyOn(manager.dataSource, 'attachItem');
manager.renderItem(0, 33, 44);
expect(manager.dataSource.attachItem).toHaveBeenCalledWith(item);
expect(item.element[0].style[ionic.CSS.TRANSFORM])
.toEqual(manager.transformString(33, 44));
expect(item.element.css).toHaveBeenCalledWith(
ionic.CSS.TRANSFORM,
manager.transformString(33, 44)
);
expect(manager.renderedItems[0]).toBe(item);
});
});