2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
2022-09-01 15:37:37 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
|
2022-09-15 08:43:17 +00:00
|
|
|
module('Integration | Routlet', function (hooks) {
|
2022-09-01 15:37:37 +00:00
|
|
|
setupTest(hooks);
|
2022-09-15 08:43:17 +00:00
|
|
|
test('outletFor works', function (assert) {
|
2022-09-01 15:37:37 +00:00
|
|
|
const routlet = this.owner.lookup('service:routlet');
|
|
|
|
routlet.addOutlet('application', {
|
|
|
|
name: 'application',
|
|
|
|
});
|
|
|
|
routlet.addRoute('dc', {});
|
|
|
|
routlet.addOutlet('dc', {
|
|
|
|
name: 'dc',
|
|
|
|
});
|
|
|
|
routlet.addRoute('dc.services', {});
|
|
|
|
routlet.addOutlet('dc.services', {
|
|
|
|
name: 'dc.services',
|
|
|
|
});
|
|
|
|
routlet.addRoute('dc.services.instances', {});
|
2022-01-07 19:16:21 +00:00
|
|
|
|
2022-09-01 15:37:37 +00:00
|
|
|
let actual = routlet.outletFor('dc.services');
|
|
|
|
let expected = 'dc';
|
|
|
|
assert.equal(actual.name, expected);
|
2022-01-07 19:16:21 +00:00
|
|
|
|
2022-09-01 15:37:37 +00:00
|
|
|
actual = routlet.outletFor('dc');
|
|
|
|
expected = 'application';
|
|
|
|
assert.equal(actual.name, expected);
|
2022-01-07 19:16:21 +00:00
|
|
|
|
2022-09-01 15:37:37 +00:00
|
|
|
actual = routlet.outletFor('application');
|
|
|
|
expected = undefined;
|
|
|
|
assert.equal(actual, expected);
|
|
|
|
});
|
2022-01-07 19:16:21 +00:00
|
|
|
});
|