host_test.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. /*
  19. var App = require('app');
  20. require('models/cluster');
  21. require('models/service');
  22. require('models/pagination');
  23. require('controllers/main/host');
  24. describe('MainHostController', function () {
  25. describe('#sortByName()', function () {
  26. it('should change isSort value to true', function () {
  27. var mainHostController = App.MainHostController.create();
  28. mainHostController.set('isSort', false);
  29. mainHostController.sortByName();
  30. expect(mainHostController.get('isSort')).to.equal(true);
  31. });
  32. it('should inverse sortingAsc ', function () {
  33. var mainHostController = App.MainHostController.create();
  34. mainHostController.set('sortingAsc', false);
  35. mainHostController.sortByName();
  36. expect(mainHostController.get('sortingAsc')).to.equal(true);
  37. mainHostController.sortByName();
  38. expect(mainHostController.get('sortingAsc')).to.equal(false);
  39. })
  40. });
  41. describe('#showNextPage, #showPreviousPage()', function () {
  42. it('should change rangeStart according to page', function () {
  43. var mainHostController = App.MainHostController.create();
  44. mainHostController.set('pageSize', 3);
  45. mainHostController.showNextPage();
  46. expect(mainHostController.get('rangeStart')).to.equal(3);
  47. mainHostController.showPreviousPage();
  48. expect(mainHostController.get('rangeStart')).to.equal(0);
  49. })
  50. });
  51. describe('#sortClass()', function () {
  52. it('should return \'icon-arrow-down\' if sortingAsc is true', function () {
  53. var mainHostController = App.MainHostController.create({});
  54. mainHostController.set('sortingAsc', true);
  55. expect(mainHostController.get('sortClass')).to.equal('icon-arrow-down');
  56. });
  57. it('should return \'icon-arrow-up\' if sortingAsc is false', function () {
  58. var mainHostController = App.MainHostController.create({});
  59. mainHostController.set('sortingAsc', false);
  60. expect(mainHostController.get('sortClass')).to.equal('icon-arrow-up');
  61. })
  62. });
  63. describe('#allChecked', function () {
  64. it('should fill selectedhostsids array', function () {
  65. var mainHostController = App.MainHostController.create();
  66. mainHostController.set('allChecked', false);
  67. expect(mainHostController.get('selectedHostsIds').length).to.equal(0);
  68. mainHostController.set('allChecked', true);
  69. expect(!!(mainHostController.get('selectedHostsIds').length)).to.equal(true);
  70. })
  71. });
  72. });
  73. */