progress_bar_view_test.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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.ProgressBarView', function () {
  20. var view = App.ProgressBarView.create();
  21. describe("#progressWidth", function () {
  22. it("depends on `progress`", function () {
  23. view.set('progress', 1);
  24. view.propertyDidChange('progressWidth');
  25. expect(view.get('progressWidth')).to.equal('width:1%;');
  26. });
  27. });
  28. describe("#barClass", function () {
  29. var testCases = [
  30. {
  31. status: 'FAILED',
  32. result: 'progress-danger'
  33. },
  34. {
  35. status: 'ABORTED',
  36. result: 'progress-warning'
  37. },
  38. {
  39. status: 'TIMED_OUT',
  40. result: 'progress-warning'
  41. },
  42. {
  43. status: 'COMPLETED',
  44. result: 'progress-success'
  45. },
  46. {
  47. status: 'QUEUED',
  48. result: 'progress-info active progress-striped'
  49. },
  50. {
  51. status: 'PENDING',
  52. result: 'progress-info active progress-striped'
  53. },
  54. {
  55. status: 'IN_PROGRESS',
  56. result: 'progress-info active progress-striped'
  57. },
  58. {
  59. status: null,
  60. result: 'progress-info'
  61. }
  62. ];
  63. testCases.forEach(function (test) {
  64. it("status is " + test.status, function () {
  65. view.set('status', test.status);
  66. view.propertyDidChange('barClass');
  67. expect(view.get('barClass')).to.equal(test.result);
  68. });
  69. });
  70. });
  71. });