mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
Move helper functions into DOM (#10051)
* Move helper functions into DOM * Add tests and comments
This commit is contained in:
@@ -172,54 +172,4 @@ suite('ComponentBase Tests', () => {
|
||||
testContainer.addToContainer(testComponent.descriptor, 0);
|
||||
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
|
||||
});
|
||||
|
||||
|
||||
test('Component convert size should add px', () => {
|
||||
const expected = '100px';
|
||||
const actual = testComponent.convertSize(100);
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert size should not add px if it already has it', () => {
|
||||
const expected = '100px';
|
||||
const actual = testComponent.convertSize('100px');
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert size should not add px if it is a percent value', () => {
|
||||
const expected = '100%';
|
||||
const actual = testComponent.convertSize('100%');
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert size should keep value if ends with %', () => {
|
||||
const expected = '100%';
|
||||
const actual = testComponent.convertSize('100%');
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert size should return the default value given undefined value %', () => {
|
||||
const expected = '200';
|
||||
const actual = testComponent.convertSize(undefined, '200');
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert to number should return size without px', () => {
|
||||
const expected = 200;
|
||||
const actual = testComponent.convertSizeToNumber('200px');
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert to number should return same value if already plain number', () => {
|
||||
const expected = 200;
|
||||
const actual = testComponent.convertSizeToNumber('200');
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
test('Component convert to number should return 0 given undefined', () => {
|
||||
const expected = 0;
|
||||
const actual = testComponent.convertSizeToNumber(undefined);
|
||||
assert.equal(expected, actual);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user