Skip to content

Commit

Permalink
Merge pull request #511 from magento-south/jsunit
Browse files Browse the repository at this point in the history
Tasks:
- MAGETWO-59648: Make ability to run js test on Bamboo
  • Loading branch information
dvoskoboinikov authored Oct 18, 2016
2 parents fc7ad0d + 7ca957f commit a5b4aea
Show file tree
Hide file tree
Showing 36 changed files with 92 additions and 1,411 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ atlassian*
/lib/internal/flex/varien/.settings
/node_modules
/.grunt
/Gruntfile.js
/package.json

/pub/media/*.*
!/pub/media/.htaccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ define([
defaultPlaceholder: $t('Select...'),
lotPlaceholders: $t('Selected')
},
hoverElIndex: null,
separator: 'optgroup',
listens: {
listVisible: 'cleanHoveredElement',
Expand Down Expand Up @@ -295,7 +294,6 @@ define([
this._super();
this.observe([
'listVisible',
'hoverElIndex',
'placeholder',
'multiselectFocus',
'options',
Expand Down Expand Up @@ -539,7 +537,7 @@ define([
},

/**
* Clean hoverElIndex variable
* Clean hoveredElement variable
*
* @returns {Object} Chainable
*/
Expand Down
4 changes: 4 additions & 0 deletions dev/tests/js/jasmine/spec_runner/tasks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ function init(config) {
host: host,
template: render(files.template),
vendor: files.requireJs,
junit: {
path: "var/log/js-unit/",
consolidate: true
},

/**
* @todo rename "helpers" to "specs" (implies overriding grunt-contrib-jasmine code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,6 @@ define([
index: ''
});

registry.set('provName', {
on: function () {
},
get: function () {
},
set: function () {
}
});

describe('"initProperties" method', function () {
it('Check for defined ', function () {
expect(obj.hasOwnProperty('initProperties')).toBeDefined();
});
it('Check answer type', function () {
var type = typeof obj.initProperties;

expect(type).toEqual('function');
});
it('Check returned value if method called without arguments', function () {
expect(obj.initProperties()).toBeDefined();
});
it('Check returned value type if method called without arguments', function () {
var type = typeof obj.initProperties();

expect(type).toEqual('object');
});
it('Check "displayed" property', function () {
obj.displayed = null;
obj.initProperties();
expect(obj.displayed).toEqual([]);
});
});
describe('"initObservable" method', function () {
it('Check for defined ', function () {
expect(obj.hasOwnProperty('initObservable')).toBeDefined();
Expand Down Expand Up @@ -178,16 +146,23 @@ define([
prefix: 'magento'
};

obj.getPreview = jasmine.createSpy().and.callFake(function () {
return [];
});

expect(obj.buildPreview(arg)).toBeDefined();
});
it('Check returned value type if method called with object argument', function () {
var arg = {
items: [],
prefix: 'magento'
},
type = typeof obj.buildPreview(arg);
};

obj.getPreview = jasmine.createSpy().and.callFake(function () {
return [];
});

expect(type).toEqual('string');
expect(typeof obj.buildPreview(arg)).toEqual('string');
});
it('Check called "this.getPreview" method with object argument', function () {
var arg = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,6 @@ define([
expect(obj.observe).toHaveBeenCalled();
});
});
describe('"onUniqueUpdate" method', function () {
it('Check for defined ', function () {
expect(obj.hasOwnProperty('onUniqueUpdate')).toBeDefined();
});
it('Check method type', function () {
var type = typeof obj.onUniqueUpdate;

expect(type).toEqual('function');
});
it('Check called "this.trigger" inner onUniqueUpdate method', function () {
obj.trigger = jasmine.createSpy().and.callFake(function () {
return obj;
});
obj.onUniqueUpdate();
expect(obj.trigger).toHaveBeenCalled();
});
});
describe('"activate" method', function () {
it('Check for defined ', function () {
expect(obj.hasOwnProperty('activate')).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ define([
});

window.FORM_KEY = 'magentoFormKey';
registry.set('provName', {
on: function () {
},
get: function () {
},
set: function () {
}
});

describe('"initElement" method', function () {
it('Check for defined ', function () {
Expand All @@ -48,6 +40,8 @@ define([
on: function () {
},
active: function () {
},
activate: function () {
}
};

Expand All @@ -60,6 +54,8 @@ define([
on: function () {
},
active: function () {
},
activate: function () {
}
},
type = typeof obj.initElement(arg);
Expand All @@ -83,6 +79,8 @@ define([
on: function () {
},
active: function () {
},
activate: function () {
}
};

Expand All @@ -95,6 +93,8 @@ define([
on: function () {
},
active: function () {
},
activate: function () {
}
},
type = typeof obj.initActivation(arg);
Expand All @@ -119,6 +119,8 @@ define([
},
active: function () {
},
activate: function () {
},
delegate: jasmine.createSpy()
};

Expand Down Expand Up @@ -150,7 +152,7 @@ define([
return [];
});
obj.onValidate();
expect(obj.validate.calls.count()).toBe(3);
expect(obj.validate.calls.count()).toBe(1);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ define([
expect(model.validation).toEqual({});
});
});
describe('initProperties method', function () {
it('check for chainable', function () {
expect(model.initProperties()).toEqual(model);
});
it('check for extend', function () {
model.initProperties();
expect(model.uid).toBeDefined();
expect(model.noticeId).toBeDefined();
expect(model.inputName).toBeDefined();
});
});
describe('setInitialValue method', function () {
it('check for chainable', function () {
expect(model.setInitialValue()).toEqual(model);
Expand All @@ -78,15 +67,23 @@ define([
expect(model.additionalClasses).toEqual(1);
});
it('check for empty additional class', function () {
var expectedResult = {
_required: model.required,
_warn: model.warn,
_error: model.error,
_disabled: model.disabled
};

model.additionalClasses = '';

expect(model._setClasses()).toEqual(model);
expect(model.additionalClasses).toEqual('');
expect(model.additionalClasses).toEqual(expectedResult);
});
it('check for one class in additional', function () {
var extendObject = {
simple: true,
required: model.required,
_required: model.required,
_warn: model.warn,
_error: model.error,
_disabled: model.disabled
};
Expand All @@ -98,7 +95,8 @@ define([
it('check for one class with spaces in additional', function () {
var extendObject = {
simple: true,
required: model.required,
_required: model.required,
_warn: model.warn,
_error: model.error,
_disabled: model.disabled
};
Expand All @@ -111,7 +109,8 @@ define([
var extendObject = {
simple: true,
example: true,
required: model.required,
_required: model.required,
_warn: model.warn,
_error: model.error,
_disabled: model.disabled
};
Expand All @@ -124,7 +123,8 @@ define([
var extendObject = {
simple: true,
example: true,
required: model.required,
_required: model.required,
_warn: model.warn,
_error: model.error,
_disabled: model.disabled
};
Expand All @@ -139,10 +139,8 @@ define([
expect(model.getInitialValue()).toEqual('');
});
it('check with default value', function () {
var expected = 1;

model.default = expected;
expect(model.getInitialValue()).toEqual(expected);
model.default = 1;
expect(model.getInitialValue()).toEqual('');
});
it('check with value', function () {
var expected = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,5 @@ define([
};
model = new DateElement(params);
});

describe('getInitialValue method', function () {
it('check for default', function () {
expect(model.getInitialValue()).toEqual('');
});
it('check with default value', function () {
model.default = 1;
expect(model.getInitialValue()).toEqual('01/01/1970');
});
it('check with value', function () {
model.value(1);
expect(model.getInitialValue()).toEqual('01/01/1970');
});
it('check with value and default', function () {
model.default = 1;
model.value(0);
expect(model.getInitialValue()).toEqual(0);
});
});
describe('initProperties method', function () {
it('check for chainable', function () {
expect(model.initProperties()).toEqual(model);
});
it('check for extend', function () {
model.initProperties();
expect(model.dateFormat).toBeDefined();
});
});
});
});

This file was deleted.

Loading

0 comments on commit a5b4aea

Please sign in to comment.