Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Ember from 'ember';
  2.  
  3. import I18nService from 'ember-i18n/services/i18n';
  4. import I18nRuLocale from 'ember-flexberry-gis/locales/ru/translations';
  5. import I18nEnLocale from 'ember-flexberry-gis/locales/en/translations';
  6.  
  7. import { moduleForComponent, test } from 'ember-qunit';
  8. import hbs from 'htmlbars-inline-precompile';
  9.  
  10. import { initialize } from 'ember-flexberry-gis/instance-initializers/owner';
  11. import startApp from '../../helpers/start-app';
  12. import destroyApp from '../../helpers/destroy-app';
  13.  
  14. let App;
  15.  
  16. moduleForComponent('flexberry-boundingbox', 'Integration | Component | flexberry boundingbox', {
  17.   integration: true,
  18.  
  19.   beforeEach: function () {
  20.     App = startApp();
  21.     Ember.run(() => {
  22.       this.application = Ember.Application.create();
  23.       this.appInstance = this.application.buildInstance();
  24.     });
  25.     this.register('locale:ru/translations', I18nRuLocale);
  26.     this.register('locale:en/translations', I18nEnLocale);
  27.     this.register('service:i18n', I18nService);
  28.  
  29.     this.inject.service('i18n', { as: 'i18n' });
  30.     Ember.Component.reopen({
  31.       i18n: Ember.inject.service('i18n')
  32.     });
  33.  
  34.     // Set 'ru' as initial locale.
  35.     this.set('i18n.locale', 'ru');
  36.   },
  37.   afterEach: function() {
  38.     Ember.run(this.appInstance, 'destroy');
  39.     Ember.run(App, 'destroy');
  40.     destroyApp(this.application);
  41.   }
  42. });
  43.  
  44. test('it renders', function(assert) {
  45.   let store = App.__container__.lookup('service:store');
  46.   initialize(this.appInstance);
  47.   Ember.run(() => {
  48.  
  49.     // Create map model.
  50.     let model = store.createRecord('new-platform-flexberry-g-i-s-map', {
  51.       name: 'testmap',
  52.       lat: 43.4012499836,
  53.       lng: 39.8487556040693,
  54.       zoom: 9.39874552061525,
  55.       public: true,
  56.       coordinateReferenceSystem: '{"code":"EPSG:4326"}'
  57.     });
  58.  
  59.     // Create layer model & add to map model.
  60.     let openStreetMapLayer = store.createRecord('new-platform-flexberry-g-i-s-map-layer', {
  61.       name: 'OSM',
  62.       type: 'tile',
  63.       visibility: true,
  64.       index: 0,
  65.       coordinateReferenceSystem: '{"code":"EPSG:3857","definition":null}',
  66.       settings: '{"opacity": 1, "url":"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}'
  67.     });
  68.     model.get('mapLayer').pushObject(openStreetMapLayer);
  69.     this.set('model', model);
  70.  
  71.     this.render(hbs`{{flexberry-boundingbox mapModel=model}}`);
  72.  
  73.     assert.equal(' ', ' ');
  74.   });
  75. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement