stack_versions_view_test.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. describe('App.MainHostStackVersionsView', function() {
  20. var view = App.MainHostStackVersionsView.create({
  21. filteredCount: 0,
  22. totalCount: 0
  23. });
  24. describe("#host", function () {
  25. before(function () {
  26. sinon.stub(App.router, 'get').returns(Em.Object.create({
  27. id: 1
  28. }));
  29. });
  30. after(function () {
  31. App.router.get.restore();
  32. });
  33. it("", function () {
  34. view.propertyDidChange('host');
  35. expect(view.get('host')).to.eql(Em.Object.create({
  36. id: 1
  37. }));
  38. });
  39. });
  40. describe("#content", function () {
  41. before(function () {
  42. sinon.stub(App.HostStackVersion, 'find').returns([Em.Object.create({
  43. id: 1
  44. })]);
  45. });
  46. after(function () {
  47. App.HostStackVersion.find.restore();
  48. });
  49. it("", function () {
  50. view.propertyDidChange('content');
  51. expect(view.get('content')).to.eql([Em.Object.create({
  52. id: 1
  53. })]);
  54. });
  55. });
  56. describe("#filteredContentInfo", function () {
  57. it("", function () {
  58. view.set('filteredCount', 1);
  59. view.set('totalCount', 2);
  60. view.propertyDidChange('filteredContentInfo');
  61. expect(view.get('filteredContentInfo')).to.eql(Em.I18n.t('hosts.host.stackVersions.table.filteredInfo').format(1, 2));
  62. });
  63. });
  64. });