Skip to content

Commit

Permalink
replicate when platform.name is absent in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Aug 7, 2024
1 parent d369580 commit f319e14
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/special-pages/pages/duckplayer/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export async function init (messaging, baseEnvironment) {
})

const settings = new Settings({})
.withPlatformName(baseEnvironment.platform)
.withPlatformName(init.platform?.name)
.withPlatformName(baseEnvironment.urlParams.get('platform'))
.withFeatureState('pip', init.settings.pip)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,7 @@ export function useOpenSettingsHandler() {
}

export function useSettingsUrl() {
const settings = useContext(SettingsContext).settings;
switch (settings.platform.name) {
case "windows":
return "duck://settings/duckplayer"
case "macos":
return "about:preferences/duckplayer"
default: {
console.warn("unreachable!")
}
}
return ''
return 'duck://settings/duckplayer'
}

export function useSettings() {
Expand Down
7 changes: 2 additions & 5 deletions packages/special-pages/tests/page-objects/duck-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class DuckPlayerPage {
},
locale: 'en',
env: 'development',
platform: { name: this.platform.name }
platform: this.platform.name === 'windows' ? undefined : { name: this.platform.name }
},
/** @type {import('../../types/duckplayer.js').UserValues} */
getUserValues: {
Expand Down Expand Up @@ -325,10 +325,7 @@ export class DuckPlayerPage {
this.page.context().on('requestfailed', resolve)
})

const expected = this.build.switch({
windows: () => 'duck://settings/duckplayer',
apple: () => 'about:preferences/duckplayer'
})
const expected = 'duck://settings/duckplayer'

const openSettings = this.page.getByRole('link', { name: 'Open Settings' })
expect(await openSettings.getAttribute('href')).toEqual(expected)
Expand Down

0 comments on commit f319e14

Please sign in to comment.