widget_test.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. require('views/main/dashboard/widget');
  20. describe('App.DashboardWidgetView', function() {
  21. var dashboardWidgetView = App.DashboardWidgetView.create();
  22. describe('#viewID', function() {
  23. it('viewID is computed with id', function() {
  24. dashboardWidgetView.set('id', 5);
  25. expect(dashboardWidgetView.get('viewID')).to.equal('widget-5');
  26. });
  27. });
  28. describe('#hoverContentTopClass', function() {
  29. var tests = [
  30. {
  31. h: ['', ''],
  32. e: 'content-hidden-two-line',
  33. m: '2 lines'
  34. },
  35. {
  36. h: ['', '', ''],
  37. e: 'content-hidden-three-line',
  38. m: '3 lines'
  39. },
  40. {
  41. h: [''],
  42. e: '',
  43. m: '1 line'
  44. },
  45. {
  46. h: [],
  47. e: '',
  48. m: '0 lines'
  49. },
  50. {
  51. h: ['', '', '', '', ''],
  52. e: 'content-hidden-five-line',
  53. m: '5 lines'
  54. },
  55. {
  56. h: ['', '', '', ''],
  57. e: 'content-hidden-four-line',
  58. m: '4 lines'
  59. }
  60. ];
  61. tests.forEach(function(test) {
  62. it(test.m, function() {
  63. dashboardWidgetView.set('hiddenInfo', test.h);
  64. expect(dashboardWidgetView.get('hoverContentTopClass')).to.equal(test.e);
  65. });
  66. });
  67. });
  68. });