Sha256: 70342a3d7c2957704a04f9463c45ef32bc485494bcf9bce5d867fd9397c6d3f5

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

import DefaultResolver from '@ember/application/globals-resolver';
import { assign } from '@ember/polyfills';
import { moduleFor, DefaultResolverApplicationTestCase } from 'internal-test-helpers';

moduleFor(
  'Application with extended default resolver and autoboot',
  class extends DefaultResolverApplicationTestCase {
    get applicationOptions() {
      let applicationTemplate = this.compile(`<h1>Fallback</h1>`);

      let Resolver = DefaultResolver.extend({
        resolveTemplate(resolvable) {
          if (resolvable.fullNameWithoutType === 'application') {
            return applicationTemplate;
          } else {
            return this._super(resolvable);
          }
        },
      });

      return assign(super.applicationOptions, {
        Resolver,
        autoboot: true,
      });
    }

    [`@test a resolver can be supplied to application`]() {
      this.runTask(() => this.createApplication());
      this.assertText('Fallback');
    }
  }
);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js
discourse-ember-source-3.5.1.1 dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js