test(ionicView): update

This commit is contained in:
Andy Joslin
2014-03-11 13:26:21 -06:00
parent e9625ded9d
commit 703f68fb0b
2 changed files with 7 additions and 7 deletions

View File

@@ -203,12 +203,12 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
* @returns {promise} A promise that will be resolved with an instance of
* an {@link ionic.controller:ionicModal} controller.
*/
fromTemplateUrl: function(url, options) {
fromTemplateUrl: function(url, options, _) {
var cb;
//Deprecated: allow a callback as second parameter. Now we return a promise.
if (arguments.length === 3) {
cb = arguments[1];
options = arguments[2] || {};
if (angular.isFunction(options)) {
cb = options;
options = _;
}
return $ionicTemplateLoader.load(url).then(function(templateString) {
var modal = createModal(templateString, options || {});

View File

@@ -23,11 +23,11 @@ describe('Ionic View', function() {
it('should broacast view enter on link', function() {
spyOn(scope, '$broadcast');
var element = compile('<ion-view title="\'Me Title\'"></ion-view>')(scope);
var element = compile('<ion-view title="Me Title"></ion-view>')(scope);
expect(scope.$broadcast).toHaveBeenCalledWith('viewState.viewEnter', { title: 'Me Title', navDirection: undefined });
scope.$navDirection = 'forward';
element = compile('<ion-view title="\'Me Title\'"></ion-view>')(scope);
element = compile('<ion-view title="Me Title"></ion-view>')(scope);
expect(scope.$broadcast).toHaveBeenCalledWith('viewState.viewEnter', { title: 'Me Title', navDirection: 'forward' });
});
@@ -109,7 +109,7 @@ describe('Ionic View', function() {
it('should show and update navBar title when using view attr or events', function() {
scope.viewTitle = 'Title';
var element = compile('<div><ion-nav-bar></ion-nav-bar><ion-view title="viewTitle"></ion-view></div>')(scope);
var element = compile('<div><ion-nav-bar></ion-nav-bar><ion-view title="{{viewTitle}}"></ion-view></div>')(scope);
scope.$digest();
var navBar = element.find('header');
var title = navBar.find('h1');