menu_test.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.MainHostMenuView', function () {
  21. beforeEach(function () {
  22. view = App.MainHostMenuView.create({});
  23. });
  24. describe('#content', function () {
  25. beforeEach(function () {
  26. this.mock = sinon.stub(App, 'get');
  27. });
  28. afterEach(function () {
  29. App.get.restore();
  30. });
  31. Em.A([
  32. {
  33. stackVersionsAvailable: true,
  34. stackUpgrade: true,
  35. m: '`versions` is visible',
  36. e: false
  37. },
  38. {
  39. stackVersionsAvailable: true,
  40. stackUpgrade: false,
  41. m: '`versions` is invisible (1)',
  42. e: true
  43. },
  44. {
  45. stackVersionsAvailable: false,
  46. stackUpgrade: true,
  47. m: '`versions` is invisible (2)',
  48. e: true
  49. },
  50. {
  51. stackVersionsAvailable: false,
  52. stackUpgrade: false,
  53. m: '`versions` is invisible (3)',
  54. e: true
  55. }
  56. ]).forEach(function (test) {
  57. it(test.m, function () {
  58. this.mock.withArgs('stackVersionsAvailable').returns(test.stackVersionsAvailable);
  59. this.mock.withArgs('supports.stackUpgrade').returns(test.stackUpgrade);
  60. view.propertyDidChange('content');
  61. expect(view.get('content').findProperty('name', 'versions').get('hidden')).to.equal(test.e);
  62. });
  63. });
  64. });
  65. });