|
@@ -28,6 +28,8 @@ function getView() {
|
|
|
|
|
|
describe('App.WizardStep1View', function () {
|
|
|
|
|
|
+ App.TestAliases.testAsComputedAnd(getView(), 'showErrorsWarningCount', ['isSubmitDisabled', 'totalErrorCnt']);
|
|
|
+
|
|
|
describe('#operatingSystems', function () {
|
|
|
beforeEach(function () {
|
|
|
sinon.stub(App.Stack, 'find', function () {
|
|
@@ -210,6 +212,8 @@ describe('App.WizardStep1View', function () {
|
|
|
|
|
|
App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked', 'operatingSystems', 'isSelected', false);
|
|
|
|
|
|
+ App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist', 'controller.content.isCheckInProgress']);
|
|
|
+
|
|
|
describe('#stacks', function () {
|
|
|
|
|
|
var tests = Em.A([
|
|
@@ -245,148 +249,9 @@ describe('App.WizardStep1View', function () {
|
|
|
|
|
|
});
|
|
|
|
|
|
- describe('#isSubmitDisabled', function () {
|
|
|
-
|
|
|
- var tests = Em.A([
|
|
|
- {
|
|
|
- invalidFormatUrlExist: false,
|
|
|
- isNoOsChecked: false,
|
|
|
- invalidUrlExist: false,
|
|
|
- checkInProgress: false,
|
|
|
- e: false
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: true,
|
|
|
- isNoOsChecked: false,
|
|
|
- invalidUrlExist: false,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: false,
|
|
|
- isNoOsChecked: true,
|
|
|
- invalidUrlExist: false,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: false,
|
|
|
- isNoOsChecked: false,
|
|
|
- invalidUrlExist: true,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: true,
|
|
|
- isNoOsChecked: false,
|
|
|
- invalidUrlExist: true,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: true,
|
|
|
- isNoOsChecked: true,
|
|
|
- invalidUrlExist: false,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: false,
|
|
|
- isNoOsChecked: true,
|
|
|
- invalidUrlExist: true,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: true,
|
|
|
- isNoOsChecked: true,
|
|
|
- invalidUrlExist: true,
|
|
|
- checkInProgress: false,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- invalidFormatUrlExist: true,
|
|
|
- isNoOsChecked: false,
|
|
|
- invalidUrlExist: false,
|
|
|
- checkInProgress: true,
|
|
|
- e: true
|
|
|
- }
|
|
|
- ]);
|
|
|
+ App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', App.Repository.validation['INVALID']);
|
|
|
|
|
|
- tests.forEach(function (test) {
|
|
|
- it(test.invalidFormatUrlExist.toString() + ' ' + test.isNoOsChecked.toString() + ' ' + test.invalidUrlExist.toString()+ ' ' + test.checkInProgress.toString(), function () {
|
|
|
- view = App.WizardStep1View.create();
|
|
|
- view.reopen({
|
|
|
- invalidFormatUrlExist: test.invalidFormatUrlExist,
|
|
|
- isNoOsChecked: test.isNoOsChecked,
|
|
|
- invalidUrlExist: test.invalidUrlExist
|
|
|
- });
|
|
|
- view.set('controller', {});
|
|
|
- view.set('controller.content', {});
|
|
|
- view.set('controller.content.isCheckInProgress', test.checkInProgress);
|
|
|
- expect(view.get('isSubmitDisabled')).to.equal(test.e);
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- describe('#showErrorsWarningCount', function() {
|
|
|
- var tests = [
|
|
|
- {
|
|
|
- isSubmitDisabled: true,
|
|
|
- totalErrorCnt: 0,
|
|
|
- e: false
|
|
|
- },
|
|
|
- {
|
|
|
- isSubmitDisabled: true,
|
|
|
- totalErrorCnt: 1,
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- isSubmitDisabled: false,
|
|
|
- totalErrorCnt: 0,
|
|
|
- e: false
|
|
|
- }
|
|
|
- ];
|
|
|
- tests.forEach(function(test) {
|
|
|
- it(test.isSubmitDisabled.toString() + ' ' + test.totalErrorCnt.toString(), function () {
|
|
|
- var view = App.WizardStep1View.create();
|
|
|
- view.reopen({
|
|
|
- isSubmitDisabled: test.isSubmitDisabled,
|
|
|
- totalErrorCnt: test.totalErrorCnt
|
|
|
- });
|
|
|
- expect(view.get('showErrorsWarningCount')).to.equal(test.e);
|
|
|
- })
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- describe('#invalidUrlExist', function () {
|
|
|
- var tests = Em.A([
|
|
|
- {
|
|
|
- allRepositories: [Em.Object.create({validation: 'icon-exclamation-sign'})],
|
|
|
- m: 'invalidCnt: 1, validation: icon-exclamation-sign',
|
|
|
- e: true
|
|
|
- },
|
|
|
- {
|
|
|
- allRepositories: [Em.Object.create({validation: ''})],
|
|
|
- m: 'invalidCnt: 1, validation: ""',
|
|
|
- e: false
|
|
|
- },
|
|
|
- {
|
|
|
- allRepositories: [Em.Object.create({validation: ''})],
|
|
|
- m: 'invalidCnt: 0, validation: ""',
|
|
|
- e: false
|
|
|
- }
|
|
|
- ]);
|
|
|
- tests.forEach(function (test) {
|
|
|
- it(test.m, function () {
|
|
|
- view = App.WizardStep1View.create();
|
|
|
- view.reopen({
|
|
|
- allRepositories: test.allRepositories
|
|
|
- });
|
|
|
- expect(view.get('invalidUrlExist')).to.equal(test.e);
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
+ App.TestAliases.testAsComputedSomeBy(getView(), 'invalidFormatUrlExist', 'allRepositories', 'invalidFormatError', true);
|
|
|
|
|
|
describe('#totalErrorCnt', function () {
|
|
|
var tests = Em.A([
|