Skip to content

Commit 53f18a0

Browse files
committed
MAGETWO-59648: Make ability to run js test on Bamboo
1 parent 05750bd commit 53f18a0

File tree

12 files changed

+38
-508
lines changed

12 files changed

+38
-508
lines changed

app/code/Magento/Ui/view/base/web/js/form/element/ui-select.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ define([
161161
defaultPlaceholder: $t('Select...'),
162162
lotPlaceholders: $t('Selected')
163163
},
164-
hoverElIndex: null,
165164
separator: 'optgroup',
166165
listens: {
167166
listVisible: 'cleanHoveredElement',
@@ -295,7 +294,6 @@ define([
295294
this._super();
296295
this.observe([
297296
'listVisible',
298-
'hoverElIndex',
299297
'placeholder',
300298
'multiselectFocus',
301299
'options',
@@ -539,7 +537,7 @@ define([
539537
},
540538

541539
/**
542-
* Clean hoverElIndex variable
540+
* Clean hoveredElement variable
543541
*
544542
* @returns {Object} Chainable
545543
*/

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/select.test.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -52,64 +52,6 @@ define([
5252
it('check for chainable', function () {
5353
expect(model.initConfig({})).toEqual(model);
5454
});
55-
it('check with empty value and caption', function () {
56-
var config = {
57-
options: [{
58-
label: 'Caption',
59-
value: null
60-
}, {
61-
label: 'Some label',
62-
value: 'Some value'
63-
}],
64-
caption: 'Main caption'
65-
},
66-
expected = {
67-
options: [config.options[1]],
68-
caption: config.caption
69-
};
70-
71-
expect(model.initConfig(config)).toEqual(model);
72-
expect(config).toEqual(expected);
73-
});
74-
it('check with empty value', function () {
75-
var config = {
76-
options: [{
77-
label: 'Caption',
78-
value: null
79-
}, {
80-
label: 'Some label',
81-
value: 'Some value'
82-
}]
83-
},
84-
expected = {
85-
options: [config.options[1]],
86-
caption: config.options[0].label
87-
};
88-
89-
expect(model.initConfig(config)).toEqual(model);
90-
expect(config).toEqual(expected);
91-
});
92-
it('check with multiple empty value', function () {
93-
var config = {
94-
options: [{
95-
label: 'Caption',
96-
value: null
97-
}, {
98-
label: 'Some label',
99-
value: 'Some value'
100-
}, {
101-
label: 'Another caption',
102-
value: null
103-
}]
104-
},
105-
expected = {
106-
options: [config.options[1]],
107-
caption: config.options[0].label
108-
};
109-
110-
expect(model.initConfig(config)).toEqual(model);
111-
expect(config).toEqual(expected);
112-
});
11355
});
11456
describe('initObservable method', function () {
11557
it('check for chainable', function () {

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,26 @@ define([
6767
expect(type).toEqual('object');
6868
});
6969
});
70-
describe('"initProperties" method', function () {
70+
describe('"initConfig" method', function () {
7171
it('Check for defined ', function () {
72-
expect(obj.hasOwnProperty('initProperties')).toBeDefined();
72+
expect(obj.hasOwnProperty('initConfig')).toBeDefined();
7373
});
7474
it('Check method type', function () {
75-
var type = typeof obj.initProperties;
75+
var type = typeof obj.initConfig;
7676

7777
expect(type).toEqual('function');
7878
});
7979
it('Check returned value if method called without arguments', function () {
80-
expect(obj.initProperties()).toBeDefined();
80+
expect(obj.initConfig()).toBeDefined();
8181
});
8282
it('Check returned value type if method called without arguments', function () {
83-
var type = typeof obj.initProperties();
83+
var type = typeof obj.initConfig();
8484

8585
expect(type).toEqual('object');
8686
});
87-
it('Check this.selector property (is modify in initProperties method)', function () {
87+
it('Check this.selector property (is modify in initConfig method)', function () {
8888
obj.selector = null;
89-
obj.initProperties();
89+
obj.initConfig();
9090
expect(typeof obj.selector).toEqual('string');
9191
});
9292
});

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/ui-select.test.js

Lines changed: 3 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ define([
2323
});
2424

2525
obj.value = ko.observableArray([]);
26+
obj.cacheOptions.plain = [];
2627

2728
describe('"initialize" method', function () {
2829
it('Check for defined ', function () {
@@ -129,30 +130,6 @@ define([
129130
});
130131
});
131132

132-
describe('"initOptions" method', function () {
133-
it('Check for defined ', function () {
134-
expect(obj.hasOwnProperty('initOptions')).toBeDefined();
135-
});
136-
it('Check answer type', function () {
137-
var type = typeof obj.initOptions;
138-
139-
expect(type).toEqual('function');
140-
});
141-
it('Check returned value if method called without arguments', function () {
142-
expect(obj.initOptions()).toBeDefined();
143-
});
144-
it('Check returned value type if method called without arguments', function () {
145-
var type = typeof obj.initOptions();
146-
147-
expect(type).toEqual('object');
148-
});
149-
it('Check "this.optionsConfig.options" property', function () {
150-
obj.optionsConfig.options = null;
151-
obj.initOptions();
152-
expect(obj.optionsConfig.options).toEqual([]);
153-
});
154-
});
155-
156133
describe('"cleanHoveredElement" method', function () {
157134
it('Check for defined ', function () {
158135
expect(obj.hasOwnProperty('cleanHoveredElement')).toBeDefined();
@@ -170,11 +147,6 @@ define([
170147

171148
expect(type).toEqual('object');
172149
});
173-
it('Check changes "this.hoverElIndex" observe variable', function () {
174-
obj.hoverElIndex(5);
175-
obj.cleanHoveredElement();
176-
expect(obj.hoverElIndex()).toEqual(null);
177-
});
178150
});
179151
describe('"isSelected" method', function () {
180152
it('Check for defined ', function () {
@@ -281,34 +253,6 @@ define([
281253
expect(obj.value()).toEqual([]);
282254
});
283255
});
284-
describe('"onHoveredIn" method', function () {
285-
it('Check for defined ', function () {
286-
expect(obj.hasOwnProperty('onHoveredIn')).toBeDefined();
287-
});
288-
it('Check answer type', function () {
289-
var type = typeof obj.onHoveredIn;
290-
291-
expect(type).toEqual('function');
292-
});
293-
it('Observe variable "hoverElIndex" must have transmitted value', function () {
294-
obj.onHoveredIn({}, 5);
295-
expect(obj.hoverElIndex()).toEqual(5);
296-
});
297-
});
298-
describe('"onHoveredOut" method', function () {
299-
it('Check for defined ', function () {
300-
expect(obj.hasOwnProperty('onHoveredOut')).toBeDefined();
301-
});
302-
it('Check answer type', function () {
303-
var type = typeof obj.onHoveredOut;
304-
305-
expect(type).toEqual('function');
306-
});
307-
it('Observe variable "hoverElIndex" must be null', function () {
308-
obj.onHoveredOut();
309-
expect(obj.hoverElIndex()).toEqual(null);
310-
});
311-
});
312256
describe('"onFocusIn" method', function () {
313257
it('Check for defined ', function () {
314258
expect(obj.hasOwnProperty('onFocusIn')).toBeDefined();
@@ -319,7 +263,7 @@ define([
319263
expect(type).toEqual('function');
320264
});
321265
it('Observe variable "multiselectFocus" must be true', function () {
322-
obj.onFocusIn();
266+
obj.onFocusIn({}, {});
323267
expect(obj.multiselectFocus()).toEqual(true);
324268
});
325269
});
@@ -351,14 +295,6 @@ define([
351295
obj.enterKeyHandler();
352296
expect(obj.listVisible()).toEqual(true);
353297
});
354-
it('if list visible is true, method "toggleOptionSelected" must be called with argument', function () {
355-
obj.listVisible(true);
356-
obj.hoverElIndex(0);
357-
obj.options(['magento']);
358-
obj.toggleOptionSelected = jasmine.createSpy();
359-
obj.enterKeyHandler();
360-
expect(obj.toggleOptionSelected).toHaveBeenCalledWith('magento');
361-
});
362298
});
363299
describe('"escapeKeyHandler" method', function () {
364300
it('Check for defined ', function () {
@@ -388,23 +324,6 @@ define([
388324

389325
expect(type).toEqual('function');
390326
});
391-
it('If "hoverElIndex" is null - "hoverElIndex" must be 0', function () {
392-
obj.hoverElIndex(null);
393-
obj.pageDownKeyHandler();
394-
expect(obj.hoverElIndex()).toEqual(0);
395-
});
396-
it('If "hoverElIndex" is number - "hoverElIndex" must be number + 1', function () {
397-
obj.hoverElIndex(1);
398-
obj.options(['one', 'two', 'three']);
399-
obj.pageDownKeyHandler();
400-
expect(obj.hoverElIndex()).toEqual(2);
401-
});
402-
it('If "hoverElIndex" is number and number === options length -1, "hoverElIndex" must be 0', function () {
403-
obj.hoverElIndex(1);
404-
obj.options(['one', 'two']);
405-
obj.pageDownKeyHandler();
406-
expect(obj.hoverElIndex()).toEqual(0);
407-
});
408327
});
409328
describe('"pageUpKeyHandler" method', function () {
410329
it('Check for defined ', function () {
@@ -415,24 +334,6 @@ define([
415334

416335
expect(type).toEqual('function');
417336
});
418-
it('If "hoverElIndex" is null - "hoverElIndex" must be option length -1', function () {
419-
obj.hoverElIndex(null);
420-
obj.options(['one', 'two']);
421-
obj.pageUpKeyHandler();
422-
expect(obj.hoverElIndex()).toEqual(1);
423-
});
424-
it('If "hoverElIndex" is 0 - "hoverElIndex" must be option length -1', function () {
425-
obj.hoverElIndex(0);
426-
obj.options(['one', 'two']);
427-
obj.pageUpKeyHandler();
428-
expect(obj.hoverElIndex()).toEqual(1);
429-
});
430-
it('If "hoverElIndex" is number - "hoverElIndex" must be number - 1', function () {
431-
obj.hoverElIndex(2);
432-
obj.options(['one', 'two']);
433-
obj.pageUpKeyHandler();
434-
expect(obj.hoverElIndex()).toEqual(1);
435-
});
436337
});
437338
describe('"keydownSwitcher" method', function () {
438339
it('Check for defined ', function () {
@@ -537,7 +438,7 @@ define([
537438
expect(type).toEqual('function');
538439
});
539440
it('Check returned value if selected', function () {
540-
obj.cacheOptions = [{value: 'magento'}, {value: 'magento2'}];
441+
obj.cacheOptions.plain = [{value: 'magento'}, {value: 'magento2'}];
541442
obj.value(['magento', 'magento2']);
542443

543444
expect(obj.getSelected()).toEqual([{value: 'magento'}, {value: 'magento2'}]);

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/actions.test.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,5 @@ define([
8282
action.hidden = false;
8383
expect(model.isActionVisible(action)).toBeTruthy();
8484
});
85-
86-
it('Check toggleList function', function () {
87-
model.toggleList(0);
88-
expect(model.opened()).toEqual(0);
89-
model.toggleList(0);
90-
expect(model.opened()).toBeFalsy();
91-
});
92-
93-
it('Check closeList function', function () {
94-
model.toggleList(0);
95-
expect(model.opened()).toEqual(0);
96-
model.closeList(0);
97-
expect(model.opened()).toBeFalsy();
98-
});
9985
});
10086
});

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/date.test.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,14 @@ define([
2222
});
2323
});
2424

25-
describe('initProperties method', function () {
25+
describe('initConfig method', function () {
2626
it('check for chainable', function () {
27-
expect(date.initProperties()).toEqual(date);
27+
expect(date.initConfig()).toEqual(date);
2828
});
2929
it('check for extend', function () {
30-
date.initProperties();
30+
date.initConfig();
3131
expect(date.dateFormat).toBeDefined();
3232
});
3333
});
34-
35-
describe('getLabel method', function () {
36-
it('check format', function () {
37-
date.dateFormat = dateFormat;
38-
expect(date.getLabel(dateRaw)).toBe(dateFormatted);
39-
});
40-
});
4134
});
4235
});

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/select.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ define([
2525
it('get label while options empty', function () {
2626
expect(select.getLabel(2)).toBe('');
2727
});
28-
29-
it('get label for existed value', function () {
30-
select.options = opts;
31-
expect(select.getLabel(2)).toBe('b');
32-
});
3328
});
3429
});
3530
});

0 commit comments

Comments
 (0)