mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 17:23:10 -05:00
Fix the select box issue (#9508)
* Fix the select box issue * map => forEach * Fix tests and a product issue * Maybe another potential fix * Fix a few more issues * Change backendValue to value * localization * Use Array.isArray
This commit is contained in:
@@ -10,9 +10,10 @@ import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
import { SelectOptionItemSQL } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
|
||||
suite('Advanced options helper tests', () => {
|
||||
let possibleInputs: string[];
|
||||
let possibleInputs: SelectOptionItemSQL[];
|
||||
let options: { [name: string]: any };
|
||||
let categoryOption: azdata.ServiceOption;
|
||||
let booleanOption: azdata.ServiceOption;
|
||||
@@ -35,8 +36,8 @@ suite('Advanced options helper tests', () => {
|
||||
description: 'Declares the application workload type when connecting to a server',
|
||||
groupName: 'Initialization',
|
||||
categoryValues: [
|
||||
{ displayName: 'ReadWrite', name: 'ReadWrite' },
|
||||
{ displayName: 'ReadOnly', name: 'ReadOnly' }
|
||||
{ displayName: 'ReadWrite', name: 'RW' },
|
||||
{ displayName: 'ReadOnly', name: 'RO' }
|
||||
],
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
@@ -110,9 +111,12 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'ReadWrite');
|
||||
assert.equal(possibleInputs.length, 3);
|
||||
assert.equal(possibleInputs[0], '');
|
||||
assert.equal(possibleInputs[1], 'ReadWrite');
|
||||
assert.equal(possibleInputs[2], 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].text, '');
|
||||
assert.equal(possibleInputs[1].text, 'ReadWrite');
|
||||
assert.equal(possibleInputs[2].text, 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].value, '');
|
||||
assert.equal(possibleInputs[1].value, 'RW');
|
||||
assert.equal(possibleInputs[2].value, 'RO');
|
||||
});
|
||||
|
||||
test('create default and required category options should set the option value and possible inputs correctly', () => {
|
||||
@@ -122,8 +126,8 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'ReadWrite');
|
||||
assert.equal(possibleInputs.length, 2);
|
||||
assert.equal(possibleInputs[0], 'ReadWrite');
|
||||
assert.equal(possibleInputs[1], 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].text, 'ReadWrite');
|
||||
assert.equal(possibleInputs[1].text, 'ReadOnly');
|
||||
});
|
||||
|
||||
test('create no default and not required category options should set the option value and possible inputs correctly', () => {
|
||||
@@ -133,9 +137,9 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
|
||||
assert.equal(optionValue, '');
|
||||
assert.equal(possibleInputs.length, 3);
|
||||
assert.equal(possibleInputs[0], '');
|
||||
assert.equal(possibleInputs[1], 'ReadWrite');
|
||||
assert.equal(possibleInputs[2], 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].text, '');
|
||||
assert.equal(possibleInputs[1].text, 'ReadWrite');
|
||||
assert.equal(possibleInputs[2].text, 'ReadOnly');
|
||||
});
|
||||
|
||||
test('create no default but required category options should set the option value and possible inputs correctly', () => {
|
||||
@@ -145,8 +149,8 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'ReadWrite');
|
||||
assert.equal(possibleInputs.length, 2);
|
||||
assert.equal(possibleInputs[0], 'ReadWrite');
|
||||
assert.equal(possibleInputs[1], 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].text, 'ReadWrite');
|
||||
assert.equal(possibleInputs[1].text, 'ReadOnly');
|
||||
});
|
||||
|
||||
test('create not required category options with option value should set the option value and possible inputs correctly', () => {
|
||||
@@ -157,9 +161,9 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'ReadOnly');
|
||||
assert.equal(possibleInputs.length, 3);
|
||||
assert.equal(possibleInputs[0], '');
|
||||
assert.equal(possibleInputs[1], 'ReadWrite');
|
||||
assert.equal(possibleInputs[2], 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].text, '');
|
||||
assert.equal(possibleInputs[1].text, 'ReadWrite');
|
||||
assert.equal(possibleInputs[2].text, 'ReadOnly');
|
||||
});
|
||||
|
||||
test('create required category options with option value should set the option value and possible inputs correctly', () => {
|
||||
@@ -170,8 +174,8 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'ReadOnly');
|
||||
assert.equal(possibleInputs.length, 2);
|
||||
assert.equal(possibleInputs[0], 'ReadWrite');
|
||||
assert.equal(possibleInputs[1], 'ReadOnly');
|
||||
assert.equal(possibleInputs[0].text, 'ReadWrite');
|
||||
assert.equal(possibleInputs[1].text, 'ReadOnly');
|
||||
});
|
||||
|
||||
test('create default but not required boolean options should set the option value and possible inputs correctly', () => {
|
||||
@@ -181,9 +185,9 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'False');
|
||||
assert.equal(possibleInputs.length, 3);
|
||||
assert.equal(possibleInputs[0], '');
|
||||
assert.equal(possibleInputs[1], 'True');
|
||||
assert.equal(possibleInputs[2], 'False');
|
||||
assert.equal(possibleInputs[0].text, '');
|
||||
assert.equal(possibleInputs[1].text, 'True');
|
||||
assert.equal(possibleInputs[2].text, 'False');
|
||||
});
|
||||
|
||||
test('create default and required boolean options should set the option value and possible inputs correctly', () => {
|
||||
@@ -193,8 +197,8 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'False');
|
||||
assert.equal(possibleInputs.length, 2);
|
||||
assert.equal(possibleInputs[0], 'True');
|
||||
assert.equal(possibleInputs[1], 'False');
|
||||
assert.equal(possibleInputs[0].text, 'True');
|
||||
assert.equal(possibleInputs[1].text, 'False');
|
||||
});
|
||||
|
||||
test('create no default and not required boolean options should set the option value and possible inputs correctly', () => {
|
||||
@@ -204,9 +208,9 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
|
||||
assert.equal(optionValue, '');
|
||||
assert.equal(possibleInputs.length, 3);
|
||||
assert.equal(possibleInputs[0], '');
|
||||
assert.equal(possibleInputs[1], 'True');
|
||||
assert.equal(possibleInputs[2], 'False');
|
||||
assert.equal(possibleInputs[0].text, '');
|
||||
assert.equal(possibleInputs[1].text, 'True');
|
||||
assert.equal(possibleInputs[2].text, 'False');
|
||||
});
|
||||
|
||||
test('create no default but required boolean options should set the option value and possible inputs correctly', () => {
|
||||
@@ -216,8 +220,8 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'True');
|
||||
assert.equal(possibleInputs.length, 2);
|
||||
assert.equal(possibleInputs[0], 'True');
|
||||
assert.equal(possibleInputs[1], 'False');
|
||||
assert.equal(possibleInputs[0].text, 'True');
|
||||
assert.equal(possibleInputs[1].text, 'False');
|
||||
});
|
||||
|
||||
test('create not required boolean options with option value should set the option value and possible inputs correctly', () => {
|
||||
@@ -228,9 +232,9 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'True');
|
||||
assert.equal(possibleInputs.length, 3);
|
||||
assert.equal(possibleInputs[0], '');
|
||||
assert.equal(possibleInputs[1], 'True');
|
||||
assert.equal(possibleInputs[2], 'False');
|
||||
assert.equal(possibleInputs[0].text, '');
|
||||
assert.equal(possibleInputs[1].text, 'True');
|
||||
assert.equal(possibleInputs[2].text, 'False');
|
||||
});
|
||||
|
||||
test('create required boolean options with option value should set the option value and possible inputs correctly', () => {
|
||||
@@ -241,8 +245,8 @@ suite('Advanced options helper tests', () => {
|
||||
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
|
||||
assert.equal(optionValue, 'False');
|
||||
assert.equal(possibleInputs.length, 2);
|
||||
assert.equal(possibleInputs[0], 'True');
|
||||
assert.equal(possibleInputs[1], 'False');
|
||||
assert.equal(possibleInputs[0].text, 'True');
|
||||
assert.equal(possibleInputs[1].text, 'False');
|
||||
});
|
||||
|
||||
test('create default number options should set the option value and possible inputs correctly', () => {
|
||||
|
||||
Reference in New Issue
Block a user