mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
amend($ionicConfigProvider): fix typo, add unit tests
This commit is contained in:
6
js/angular/service/ionicConfig.js
vendored
6
js/angular/service/ionicConfig.js
vendored
@@ -25,7 +25,7 @@ IonicModule
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $ionicConfigProvider#prefetchTemplates
|
||||
* @description Set whether Ionic should prefetch all templateUrls defined in
|
||||
* @description Set whether Ionic should prefetch all templateUrls defined in
|
||||
* $stateProvider.state. Default true. If set to false, the user will have to wait
|
||||
* for a template to be fetched the first time he/she is going to a a new page.
|
||||
* @param shouldPrefetch Whether Ionic should prefetch templateUrls defined in
|
||||
@@ -34,9 +34,9 @@ IonicModule
|
||||
*/
|
||||
this.prefetchTemplates = function(newValue) {
|
||||
if (arguments.length) {
|
||||
config.prefetchTemlates = newValue;
|
||||
config.prefetchTemplates = newValue;
|
||||
}
|
||||
return config.prefetchTemlates;
|
||||
return config.prefetchTemplates;
|
||||
};
|
||||
|
||||
// private: Service definition for internal Ionic use
|
||||
|
||||
22
test/unit/angular/service/ionicConfig.unit.js
Normal file
22
test/unit/angular/service/ionicConfig.unit.js
Normal file
@@ -0,0 +1,22 @@
|
||||
describe('$ionicConfigProvider', function() {
|
||||
|
||||
it('should give default true', function() {
|
||||
module('ionic', function($ionicConfigProvider) {
|
||||
expect($ionicConfigProvider.prefetchTemplates()).toBe(true);
|
||||
});
|
||||
inject(function($ionicConfig) {
|
||||
expect($ionicConfig.prefetchTemplates).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow setting', function() {
|
||||
module('ionic', function($ionicConfigProvider) {
|
||||
$ionicConfigProvider.prefetchTemplates(false);
|
||||
expect($ionicConfigProvider.prefetchTemplates()).toBe(false);
|
||||
});
|
||||
inject(function($ionicConfig) {
|
||||
expect($ionicConfig.prefetchTemplates).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user