pxf_live_test.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. require('views/main/dashboard/widgets/text_widget');
  21. require('views/main/dashboard/widgets/pxf_live');
  22. var view;
  23. function testCounterOrNa(propertyName, dependentKey) {
  24. describe('#' + propertyName, function () {
  25. beforeEach(function () {
  26. view.reopen({
  27. model: Em.Object.create()
  28. });
  29. view.get('model').set(dependentKey, []);
  30. });
  31. it('n/a (1)', function () {
  32. view.get('model').set(dependentKey, null);
  33. expect(view.get(propertyName)).to.be.equal(Em.I18n.t('services.service.summary.notAvailable'));
  34. });
  35. it('n/a (2)', function () {
  36. view.get('model').set(dependentKey, undefined);
  37. expect(view.get(propertyName)).to.be.equal(Em.I18n.t('services.service.summary.notAvailable'));
  38. });
  39. it('value exist', function () {
  40. view.get('model').set(dependentKey, 123);
  41. expect(view.get(propertyName)).to.be.equal(123);
  42. });
  43. });
  44. }
  45. describe('App.PxfUpView', function() {
  46. beforeEach(function () {
  47. view = App.PxfUpView.create();
  48. });
  49. testCounterOrNa('pxfsStarted', 'pxfsStarted');
  50. testCounterOrNa('pxfsInstalled', 'pxfsInstalled');
  51. testCounterOrNa('pxfsStarted', 'pxfsStarted');
  52. });