Merge pull request #1985 from opf/fix/16486_workpackage_list_throws_500_with_target_version_filter

16486 workpackage list throws 500 with target version filter
pull/1989/head
Philipp Tessenow 10 years ago
commit 19cface7be
  1. 2
      app/assets/javascripts/angular/directives/components/toggled-multiselect-directive.js
  2. 68
      karma/tests/directives/components/toggled-multiselect-directive-test.js

@ -50,7 +50,7 @@ angular.module('openproject.uiComponents')
function switchToMultiSelect() {
scope.isMultiselect = true;
if (!Array.isArray(scope.values)) {
if (scope.values && !Array.isArray(scope.values)) {
scope.values = [scope.values];
}
}

@ -41,8 +41,7 @@ describe('toggledMultiselect Directive', function() {
}));
beforeEach(inject(function($rootScope, $compile) {
var html;
html = '<toggled-multiselect icon-name="cool-icon.png" name="name" values="values" available-options="options"></toggled-multiselect>';
var html = '<toggled-multiselect icon-name="cool-icon.png" name="name" values="values" available-options="options"></toggled-multiselect>';
element = angular.element(html);
rootScope = $rootScope;
@ -54,7 +53,7 @@ describe('toggledMultiselect Directive', function() {
};
}));
describe('element', function() {
describe('with values', function() {
beforeEach(function() {
scope.name = "BO' SELECTA";
scope.values = [
@ -68,30 +67,57 @@ describe('toggledMultiselect Directive', function() {
compile();
});
it('should render a div', function() {
expect(element.prop('tagName')).to.equal('DIV');
});
describe('element', function() {
it('should render a div', function() {
expect(element.prop('tagName')).to.equal('DIV');
});
it('should render only one select', function() {
expect(element.find('select').size()).to.equal(1);
expect(element.find('select.ng-hide').size()).to.equal(0);
});
it('should render two OPTIONs for displayed SELECT', function() {
var select = element.find('select:not(.ng-hide)').first();
expect(select.find('option').size()).to.equal(2);
var option = select.find('option').first();
expect(option.val()).to.equal('NY');
expect(option.text()).to.equal('New York');
});
it('should render only one select', function() {
expect(element.find('select').size()).to.equal(1);
expect(element.find('select.ng-hide').size()).to.equal(0);
xit('should render a link that toggles multi-select', function() {
var a = element.find('a');
expect(element.find('select.ng-hide').size()).to.equal(1);
a.click();
scope.$apply();
expect(element.find('select.ng-hide').size()).to.equal(1);
});
});
});
describe('w/o values', function() {
beforeEach(function() {
scope.name = "BO' SELECTA";
scope.options = [
['New York', 'NY'],
['California', 'CA']
];
it('should render two OPTIONs for displayed SELECT', function() {
var select = element.find('select:not(.ng-hide)').first();
expect(select.find('option').size()).to.equal(2);
compile();
var option = select.find('option').first();
expect(option.val()).to.equal('NY');
expect(option.text()).to.equal('New York');
var multiselectToggleElement = element.find('a');
multiselectToggleElement.trigger('click');
});
xit('should render a link that toggles multi-select', function() {
var a = element.find('a');
expect(element.find('select.ng-hide').size()).to.equal(1);
a.click();
scope.$apply();
expect(element.find('select.ng-hide').size()).to.equal(1);
describe('scope.values', function() {
it('should not become an array', function() {
expect(Array.isArray(scope.values)).to.be.false;
});
it('should leave scope.values as undefined', function() {
expect(scope.values).to.be.undefined;
});
});
});
});

Loading…
Cancel
Save