Skip to content

Commit bd2b6dc

Browse files
author
Tom Wilson
committed
added spec test to confirm that orderByPriority filter errors in safari
1 parent e3fb121 commit bd2b6dc

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"karma": "~0.10.4",
3131
"karma-chrome-launcher": "~0.1.0",
3232
"protractor": "~0.12.1",
33-
"lodash": "~2.4.1"
33+
"lodash": "~2.4.1",
34+
"karma-safari-launcher": "~0.1.1"
3435
}
3536
}

tests/automatic_karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ module.exports = function(config) {
1616

1717
autoWatch: true,
1818
//Recommend starting Chrome manually with experimental javascript flag enabled, and open localhost:9876.
19-
browsers: ['Chrome']
19+
browsers: ['Chrome', 'Safari']
2020
});
2121
};

tests/unit/orderbypriority.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,24 @@ describe('OrderByPriority Filter', function () {
4040
});
4141
expect(res).toEqual(originalData);
4242
});
43+
44+
it('should return an array from a $firebase instance array', function () {
45+
var loaded = false;
46+
// autoFlush makes all Firebase methods trigger immediately
47+
var fb = new Firebase('Mock//sort',
48+
{data: {'0': 'foo', '1': 'bar'}}
49+
).child('data').autoFlush();
50+
var ref = $firebase(fb);
51+
// $timeout is a mock, so we have to tell the mock when to trigger it
52+
// and fire all the angularFire events
53+
$timeout.flush();
54+
// now we can actually trigger our filter and pass in the $firebase ref
55+
var res = $filter('orderByPriority')(ref);
56+
// and finally test the results against the original data in Firebase instance
57+
var originalData = _.map(fb.getData(), function(v, k) {
58+
return _.isObject(v)? _.assign({'$id': k}, v) : v;
59+
});
60+
expect(res).toEqual(originalData);
61+
});
62+
4363
});

0 commit comments

Comments
 (0)