|
|
|
@ -5,8 +5,21 @@ describe('queryMenuItem Directive', function() { |
|
|
|
|
beforeEach(angular.mock.module('openproject.layout')); |
|
|
|
|
beforeEach(module('templates', 'openproject.services', 'openproject.models')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beforeEach(module('templates', function($provide) { |
|
|
|
|
$provide.value('$stateParams', stateParams); |
|
|
|
|
|
|
|
|
|
var QueryServiceMock = { |
|
|
|
|
queryName: 'Default', |
|
|
|
|
updateHighlightName: function() { |
|
|
|
|
return { |
|
|
|
|
then: function(callback) { |
|
|
|
|
return callback(QueryServiceMock.queryName[1]); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
$provide.value('QueryService', QueryServiceMock); |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
beforeEach(inject(function($rootScope, $compile) { |
|
|
|
@ -78,4 +91,20 @@ describe('queryMenuItem Directive', function() { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('when the renameQueryItem event is received', function() { |
|
|
|
|
var queryName = 'A query to find them all'; |
|
|
|
|
|
|
|
|
|
beforeEach(function() { |
|
|
|
|
rootScope.$broadcast('openproject.layout.renameQueryMenuItem', { |
|
|
|
|
itemType: 'query-menu-item', |
|
|
|
|
queryid: queryId, |
|
|
|
|
queryName: queryName |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('resets the menu item title', function() { |
|
|
|
|
expect(element.text()).to.equal(queryName); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|