wizard_menu_view_test.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. var view;
  20. describe('App.WizardMenuMixin', function () {
  21. beforeEach(function () {
  22. view = Em.View.create(App.WizardMenuMixin, {
  23. controller: Em.Object.create({
  24. isStepDisabled: []
  25. })
  26. });
  27. });
  28. describe("#isStepDisabled()", function () {
  29. it("step 1 disabled", function () {
  30. view.set('controller.isStepDisabled', [Em.Object.create({
  31. step: 1,
  32. value: true
  33. })]);
  34. expect(view.isStepDisabled(1)).to.be.true;
  35. });
  36. });
  37. describe("#isStep#Disabled", function () {
  38. var testCases = [
  39. {
  40. property: 'isStep0Disabled',
  41. step: 0
  42. },
  43. {
  44. property: 'isStep1Disabled',
  45. step: 1
  46. },
  47. {
  48. property: 'isStep2Disabled',
  49. step: 2
  50. },
  51. {
  52. property: 'isStep3Disabled',
  53. step: 3
  54. },
  55. {
  56. property: 'isStep4Disabled',
  57. step: 4
  58. },
  59. {
  60. property: 'isStep5Disabled',
  61. step: 5
  62. },
  63. {
  64. property: 'isStep6Disabled',
  65. step: 6
  66. },
  67. {
  68. property: 'isStep7Disabled',
  69. step: 7
  70. },
  71. {
  72. property: 'isStep8Disabled',
  73. step: 8
  74. },
  75. {
  76. property: 'isStep9Disabled',
  77. step: 9
  78. },
  79. {
  80. property: 'isStep10Disabled',
  81. step: 10
  82. }
  83. ];
  84. testCases.forEach(function (test) {
  85. it("step" + test.step + " disabled", function () {
  86. view.set('controller.isStepDisabled', [Em.Object.create({
  87. step: test.step,
  88. value: true
  89. })]);
  90. view.propertyDidChange(test.property);
  91. expect(view.get(test.property)).to.be.true;
  92. });
  93. }, this);
  94. });
  95. });