/*global describe, beforeEach, module, inject, it, spyOn, expect, $ */ describe('uiRoute', function () { 'use strict'; var scope, $compile, $location; beforeEach(module('ui.directives')); beforeEach(inject(function (_$rootScope_, _$compile_, _$window_, _$location_) { scope = _$rootScope_.$new(); $compile = _$compile_; $location = _$location_; })); function setPath(path) { $location.path(path); scope.$broadcast('$routeChangeSuccess'); scope.$apply(); } describe('model is null', function() { runTests(); }); describe('model is set', function() { runTests('pizza'); }); function runTests(routeModel) { function compileRoute(template) { var elm = $(template); if (routeModel) elm.attr('ng-model', routeModel); return $compile(elm[0])(scope); } var modelProp = routeModel || '$uiRoute'; describe('with uiRoute defined', function(){ it('should use the uiRoute property', function(){ compileRoute('