|
|
@ -109,21 +109,40 @@ describe('queryMenuItemFactory', function() { |
|
|
|
|
|
|
|
|
|
|
|
describe('when the query id matches the query id of the state params', function() { |
|
|
|
describe('when the query id matches the query id of the state params', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = objectId; |
|
|
|
stateParams['query_id'] = objectId; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
it('marks the new item as selected', function() { |
|
|
|
it('marks the new item as selected', function() { |
|
|
|
|
|
|
|
$rootScope.$broadcast('openproject.layout.activateMenuItem'); |
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('toggles the selected state on state change', function() { |
|
|
|
it('toggles the selected state on state change', function() { |
|
|
|
stateParams.query_id = null; |
|
|
|
stateParams['query_id'] = null; |
|
|
|
$rootScope.$broadcast('openproject.layout.activateMenuItem'); |
|
|
|
$rootScope.$broadcast('openproject.layout.activateMenuItem'); |
|
|
|
|
|
|
|
|
|
|
|
expect(itemLink.hasClass('selected')).to.be.false; |
|
|
|
expect(itemLink.hasClass('selected')).to.be.false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('when the query id is undefined', function(){ |
|
|
|
|
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
|
|
|
|
stateParams['query_id'] = objectId; |
|
|
|
|
|
|
|
$timeout.flush(); |
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('marks the new item as unselected', function() { |
|
|
|
|
|
|
|
expect(itemLink.hasClass('selected')).to.be.false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('toggles the selected state on state change', function() { |
|
|
|
|
|
|
|
stateParams['query_id'] = objectId; |
|
|
|
|
|
|
|
$rootScope.$broadcast('openproject.layout.activateMenuItem'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('#generateMenuItem for the work package index item', function() { |
|
|
|
describe('#generateMenuItem for the work package index item', function() { |
|
|
@ -145,29 +164,31 @@ describe('queryMenuItemFactory', function() { |
|
|
|
|
|
|
|
|
|
|
|
describe('for an undefined query_id', function() { |
|
|
|
describe('for an undefined query_id', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = undefined; |
|
|
|
stateParams['query_id'] = undefined; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
it('marks the item as selected', function() { |
|
|
|
it('marks the item as selected', function() { |
|
|
|
|
|
|
|
$rootScope.$broadcast('openproject.layout.activateMenuItem'); |
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('for a null query_id', function() { |
|
|
|
describe('for a null query_id', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = null; |
|
|
|
stateParams['query_id'] = null; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
it('marks the item as selected', function() { |
|
|
|
it('marks the item as selected', function() { |
|
|
|
|
|
|
|
$rootScope.$broadcast('openproject.layout.activateMenuItem'); |
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
expect(itemLink.hasClass('selected')).to.be.true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('for an integer query_id', function() { |
|
|
|
describe('for an integer query_id', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = 1; |
|
|
|
stateParams['query_id'] = 1; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
@ -178,7 +199,7 @@ describe('queryMenuItemFactory', function() { |
|
|
|
|
|
|
|
|
|
|
|
describe('for a string query_id', function() { |
|
|
|
describe('for a string query_id', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = "1"; |
|
|
|
stateParams['query_id'] = "1"; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
@ -196,7 +217,7 @@ describe('queryMenuItemFactory', function() { |
|
|
|
|
|
|
|
|
|
|
|
describe('for an undefined query_id', function() { |
|
|
|
describe('for an undefined query_id', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = undefined; |
|
|
|
stateParams['query_id'] = undefined; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
@ -207,7 +228,7 @@ describe('queryMenuItemFactory', function() { |
|
|
|
|
|
|
|
|
|
|
|
describe('for a null query_id', function() { |
|
|
|
describe('for a null query_id', function() { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
beforeEach(inject(function($timeout) { |
|
|
|
stateParams.query_id = null; |
|
|
|
stateParams['query_id'] = null; |
|
|
|
$timeout.flush(); |
|
|
|
$timeout.flush(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|