Sha256: 722cf5363a28e99db3afa36e420b8fd541d2d69c6b7f3479763dfdf7246562ce

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

import { RouterTestCase, moduleFor } from 'internal-test-helpers';
import { EMBER_ROUTING_ROUTER_SERVICE } from '@ember/canary-features';

if (EMBER_ROUTING_ROUTER_SERVICE) {
  moduleFor(
    'Deprecated Transition State',
    class extends RouterTestCase {
      '@test touching transition.state is deprecated'(assert) {
        assert.expect(1);
        return this.visit('/').then(() => {
          this.routerService.on('routeWillChange', transition => {
            expectDeprecation(() => {
              transition.state;
            }, 'You attempted to read "transition.state" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the public state on it.');
          });
          return this.routerService.transitionTo('/child');
        });
      }

      '@test touching transition.queryParams is deprecated'(assert) {
        assert.expect(1);
        return this.visit('/').then(() => {
          this.routerService.on('routeWillChange', transition => {
            expectDeprecation(() => {
              transition.queryParams;
            }, 'You attempted to read "transition.queryParams" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the queryParams on it.');
          });
          return this.routerService.transitionTo('/child');
        });
      }

      '@test touching transition.params is deprecated'(assert) {
        assert.expect(1);
        return this.visit('/').then(() => {
          this.routerService.on('routeWillChange', transition => {
            expectDeprecation(() => {
              transition.params;
            }, 'You attempted to read "transition.params" which is a private API. You should read the `RouteInfo` object on "transition.to" or "transition.from" which has the params on it.');
          });
          return this.routerService.transitionTo('/child');
        });
      }
    }
  );
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/ember/tests/routing/deprecated_transition_state_test.js