Sha256: a4e4e34390439d720e45512489c874ade4aecc5c9a545f161bc8586e547ab812

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

import TestResolverApplicationTestCase from './test-resolver-application';
import Application from '@ember/application';
import { Router } from 'ember-routing';
import { assign } from '@ember/polyfills';

export default class ApplicationTestCase extends TestResolverApplicationTestCase {
  constructor() {
    super(...arguments);

    let { applicationOptions } = this;
    this.application = this.runTask(this.createApplication.bind(this, applicationOptions));

    this.resolver = this.application.__registry__.resolver;

    if (this.resolver) {
      this.resolver.add('router:main', Router.extend(this.routerOptions));
    }
  }

  createApplication(myOptions = {}, MyApplication = Application) {
    return MyApplication.create(myOptions);
  }

  get applicationOptions() {
    return assign(super.applicationOptions, {
      autoboot: false,
    });
  }

  get appRouter() {
    return this.applicationInstance.lookup('router:main');
  }

  transitionTo() {
    return this.runTask(() => {
      return this.appRouter.transitionTo(...arguments);
    });
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/internal-test-helpers/lib/test-cases/application.js
discourse-ember-source-3.5.1.0 dist/dist/es/internal-test-helpers/lib/test-cases/application.js