diff options
author | Joar Wandborg <git@wandborg.com> | 2012-01-28 18:47:01 +0100 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-01-28 18:47:01 +0100 |
commit | 3d0d3bc97270095fae5f9a2508068631c46a5e61 (patch) | |
tree | 76778fcacaae35fc5662f276dab512a07bcee186 /extlib/leaflet/spec/suites/core/UtilSpec.js | |
parent | d7bec8577ea1b4d83df097f586324445fed1ef50 (diff) | |
parent | 9542a2ba076b7e00e79d7adb1a4e90a095427645 (diff) | |
download | mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.tar.lz mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.tar.xz mediagoblin-3d0d3bc97270095fae5f9a2508068631c46a5e61.zip |
Merge remote-tracking branch 'joar/exif-rebase'
Diffstat (limited to 'extlib/leaflet/spec/suites/core/UtilSpec.js')
-rw-r--r-- | extlib/leaflet/spec/suites/core/UtilSpec.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/extlib/leaflet/spec/suites/core/UtilSpec.js b/extlib/leaflet/spec/suites/core/UtilSpec.js new file mode 100644 index 00000000..46cb8fba --- /dev/null +++ b/extlib/leaflet/spec/suites/core/UtilSpec.js @@ -0,0 +1,63 @@ +describe('Util', function() {
+
+ describe('#extend', function() {
+ var a;
+
+ beforeEach(function() {
+ a = {
+ foo: 5,
+ bar: 'asd'
+ };
+ });
+
+ it('should extend the first argument with the properties of the second', function() {
+ L.Util.extend(a, {
+ bar: 7,
+ baz: 3
+ });
+
+ expect(a).toEqual({
+ foo: 5,
+ bar: 7,
+ baz: 3
+ });
+ });
+
+ it('should work with more than 2 arguments', function() {
+ L.Util.extend(a, {bar: 7}, {baz: 3});
+
+ expect(a).toEqual({
+ foo: 5,
+ bar: 7,
+ baz: 3
+ });
+ });
+ });
+
+ describe('#bind', function() {
+ it('should return the given function with the given context', function() {
+ var fn = function() {
+ return this;
+ };
+
+ var fn2 = L.Util.bind(fn, 5);
+
+ expect(fn2()).toEqual(5);
+ });
+ });
+
+ describe('#stamp', function() {
+ it('should set a unique id on the given object and return it', function() {
+ var a = {},
+ id = L.Util.stamp(a);
+
+ expect(typeof id).toEqual('number');
+ expect(L.Util.stamp(a)).toEqual(id);
+
+ var b = {},
+ id2 = L.Util.stamp(b);
+
+ expect(id2).not.toEqual(id);
+ });
+ });
+});
\ No newline at end of file |