This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Merge branch 'refs/heads/unit-tests'""
This reverts commit 251bc77.
- Loading branch information
zamrzlaj
committed
Nov 2, 2012
1 parent
9ead18c
commit e6c4f77
Showing
13 changed files
with
2,048 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
describe('ngx.date', function() { | |||
beforeEach(module('ngx.date', 'ngx.config')); | |||
|
|||
it('should format datetime', inject(function(ngxDate) { | |||
expect(ngxDate.format('Y-m-d', 1351375200)).toEqual('2012-10-28'); | |||
expect(ngxDate.format('j.n.Y H:i:s', 1348815030)).toEqual('28.9.2012 08:50:30'); | |||
})); | |||
|
|||
it('should check datetime', inject(function(ngxDate) { | |||
expect(ngxDate.check(2012, 12, 21)).toBeTruthy(); | |||
expect(ngxDate.check(2000, 1, 1)).toBeTruthy(); | |||
expect(ngxDate.check(2010, 13, 10)).toBeFalsy(); | |||
expect(ngxDate.check(1980, 2, 31)).toBeFalsy(); | |||
})); | |||
}); |
This file contains 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 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
describe('ngx.dictionary', function() { | |||
var items = { | |||
en: { | |||
dictionary: 'dictionary', | |||
item: 'item', | |||
test: 'should register items' | |||
}, | |||
cz: { | |||
dictionary: 'slovník', | |||
item: 'položka', | |||
test: 'měl by zaregistrovat položky' | |||
} | |||
}; | |||
|
|||
beforeEach(function() { | |||
module('ngx.dictionary'); | |||
|
|||
// change default angular english $locale to czech | |||
inject(function($locale) { | |||
$locale.id = 'cz-cs'; | |||
}); | |||
|
|||
inject(function(ngxDictionary) { | |||
ngxDictionary.addItems('en', items.en); | |||
ngxDictionary.addItems('cz', items.cz); | |||
}); | |||
}); | |||
|
|||
it('should return item by default $locale language', inject(function(ngxDictionary) { | |||
// default angular locale is english | |||
expect(ngxDictionary('test')).toEqual(items.cz.test); | |||
expect(ngxDictionary('item')).toEqual(items.cz.item); | |||
expect(ngxDictionary('dictionary')).toEqual(items.cz.dictionary); | |||
})); | |||
|
|||
it('should return item by specified/set language', inject(function(ngxDictionary) { | |||
expect(ngxDictionary('test')).toEqual(items.cz.test); | |||
expect(ngxDictionary('dictionary', 'en')).toEqual(items.en.dictionary); | |||
|
|||
// change default language | |||
ngxDictionary.setLanguage('en'); | |||
expect(ngxDictionary('item')).toEqual(items.en.item); | |||
expect(ngxDictionary('test', 'cz')).toEqual(items.cz.test); | |||
expect(ngxDictionary('test', 'en')).toEqual(items.en.test); | |||
})); | |||
|
|||
}); |
This file contains 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 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,19 @@ | |||
describe('ngx.loader', function() { | |||
beforeEach(function() { | |||
module('ngx.loader'); | |||
}); | |||
|
|||
it('should not load same files twice', inject(function(ngxLoader) { | |||
ngxLoader(['test1.js', 'test2.js', 'test1.js'], waitsFor(function() { | |||
expect(ngxLoader.getLoaded().length).toEqual(2); | |||
return true; | |||
})); | |||
})); | |||
|
|||
it('should throw an exception on unsupported type', inject(function(ngxLoader) { | |||
expect(function() { | |||
ngxLoader('image.jpg'); | |||
}).toThrow('File type not supported'); | |||
})); | |||
|
|||
}); |
This file contains 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
Oops, something went wrong.