Sha256: 1b0d724838acc877779bcf0ac3a3060f819284c800bf2c4421233796540838ff

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

import AbstractApplicationTestCase from './abstract-application';
import DefaultResolver from '@ember/application/globals-resolver';
import Application from '@ember/application';
import { setTemplates, setTemplate } from '@ember/-internals/glimmer';
import { assign } from '@ember/polyfills';
import { Router } from '@ember/-internals/routing';

export default class ApplicationTestCase extends AbstractApplicationTestCase {
  createApplication() {
    let application = (this.application = Application.create(this.applicationOptions));
    application.Router = Router.extend(this.routerOptions);
    return application;
  }

  get applicationOptions() {
    return assign(super.applicationOptions, {
      name: 'TestApp',
      autoboot: false,
      Resolver: DefaultResolver,
    });
  }

  afterEach() {
    setTemplates({});
    return super.afterEach();
  }

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

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

  addTemplate(name, templateString) {
    let compiled = this.compile(templateString);
    setTemplate(name, compiled);
    return compiled;
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/internal-test-helpers/lib/test-cases/default-resolver-application.js