chore: 🤖 deprecate window object service (#1652)
* chore: 🤖 deprecate window object service Deprecate `browser-object` service in favor of `ember-browser-services` ✅ Closes: ICU-7152 * refactor: 💡 cluster-url test fail commit with cluster-url test failing ✅ Closes: ICU-7152 * refactor: 💡 refactor test to reflect changes Refactor test to reflect `browser/window` service in `cluster-url` route ✅ Closes: ICU-7152 * refactor: 💡 refactor cluster url test change logic of mockIPC to a function call ✅ Closes: ICU-7152
This commit is contained in:
1 parent
0a76111944
commit
3ba53dfc2e
8 files changed
+27
-104
No files matched your search
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import Service from '@ember/service';
|
||||
|
||||
/**
|
||||
* A simple service that wraps around the global window and
|
||||
* document variables that allows us to mock them in testing
|
||||
*/
|
||||
export default class BrowserObjectService extends Service {
|
||||
/**
|
||||
* The global window object
|
||||
* @returns {Window}
|
||||
*/
|
||||
get window() {
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
* The global document object
|
||||
* @returns {Document}
|
||||
*/
|
||||
get document() {
|
||||
return this.window?.document;
|
||||
}
|
||||
|
||||
/**
|
||||
* The hostname of the current location of the URL
|
||||
* @returns {string}
|
||||
*/
|
||||
get hostname() {
|
||||
return this.window?.location?.hostname;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
export { default } from 'core/services/browser-object';
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: MPL-2.0
|
||||
*/
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Service | browser-object', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it contains a window', function (assert) {
|
||||
let service = this.owner.lookup('service:browser-object');
|
||||
assert.ok(service.window, 'Service contains a window');
|
||||
});
|
||||
|
||||
test('it contains a document', function (assert) {
|
||||
let service = this.owner.lookup('service:browser-object');
|
||||
assert.ok(service.document, 'Service contains a document');
|
||||
});
|
||||
|
||||
test('it contains a hostname', function (assert) {
|
||||
let service = this.owner.lookup('service:browser-object');
|
||||
assert.ok(service.hostname, 'Service contains a hostname');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user