Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ember-window-mock, drop unused glue code #399

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/eighty-swans-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'ember-browser-services': major
---

Update ember-window-mock, drop unneeded glue code

There is a potentially breaking change, as you cannot mock `window.location.origin` directly anymore. But this should not restrict you, as you can set `window.location.href`, and `origin` will be correctly reflected. Having `origin` not be aligned with `href` can never happen in reality, since `origin` is a read-only property, so having these diverge in tests is not really useful.
5 changes: 1 addition & 4 deletions ember-browser-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@embroider/addon-shim": "^1.3.0",
"ember-window-mock": "^0.8.1"
"ember-window-mock": "^1.0.1"
},
"devDependencies": {
"@babel/core": "7.24.9",
Expand Down Expand Up @@ -100,8 +100,5 @@
"./services/browser/window.js": "./dist/_app_/services/browser/window.js"
}
},
"volta": {
"extends": "../package.json"
},
"types": "dist"
}
11 changes: 1 addition & 10 deletions ember-browser-services/src/test-support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
FakeLocalStorageService,
FakeSessionStorageService,
} from './-private/web-storage';
import { patchWindow } from './window-mock-augments';

import type { RecursivePartial } from '../types';

Expand Down Expand Up @@ -38,10 +37,7 @@ export function setupBrowserFakes(hooks: NestedHooks, options: Fakes): void {
};

if (options.window) {
// default, can still be overwritten
// see: https://github.com/kaliber5/ember-window-mock/issues/175
let patched = patchWindow(window);
let service = maybeMake(options.window, patched);
let service = maybeMake(options.window, window);

owner.register('service:browser/window', service);
}
Expand Down Expand Up @@ -105,11 +101,6 @@ export function maybeMake<

// we are already using ember-window-mock, so the proxy internal to that package will
// "just handle" setting stuff on the window
//
// NOTE:
// - Location implementation is incomplete:
// https://github.com/kaliber5/ember-window-mock/blob/2b8fbf581fc65e7f5455cd291497a3fdc2efdaf5/addon-test-support/-private/mock/location.js#L23
// - does not allow setting "origin"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function applyStub(root: any, partial?: any) {
if (!partial) return root;

Expand Down
56 changes: 0 additions & 56 deletions ember-browser-services/src/test-support/window-mock-augments.ts

This file was deleted.

Loading
Loading