File tree Expand file tree Collapse file tree 4 files changed +18
-53
lines changed Expand file tree Collapse file tree 4 files changed +18
-53
lines changed Original file line number Diff line number Diff line change 25
25
* On Page Load
26
26
* - {@link DuckPlayerPageMessages.onUserValuesChanged} begins immediately. It expects an initial value, and then will continue to listen for updates
27
27
*
28
- * Then the following 2 messages can be sent at any time
28
+ * Then the following message can be sent at any time
29
29
* - {@link DuckPlayerPageMessages.setUserValues}
30
- * - {@link DuckPlayerPageMessages.openSettings}
31
30
*
32
31
* Please see {@link DuckPlayerPageMessages} for the up-to-date list
33
32
*/
34
33
import {
35
34
Messaging ,
36
35
WindowsMessagingConfig ,
37
- WebkitMessagingConfig ,
38
36
MessagingContext , TestTransportConfig
39
37
} from '../../../../../messaging/index.js'
40
- import { DuckPlayerPageMessages , UserValues , OpenSettings } from './messages'
38
+ import { DuckPlayerPageMessages , UserValues } from './messages'
41
39
42
40
// for docs
43
- export { DuckPlayerPageMessages , UserValues , OpenSettings }
41
+ export { DuckPlayerPageMessages , UserValues }
44
42
45
43
const VideoPlayer = {
46
44
/**
@@ -520,10 +518,9 @@ const Setting = {
520
518
} )
521
519
522
520
const settingsIcon = Setting . settingsIcon ( )
523
- settingsIcon . addEventListener ( 'click' , ( e ) => {
524
- e . preventDefault ( )
525
- Comms . messaging . openSettings ( new OpenSettings ( { target : 'duckplayer' } ) )
526
- } )
521
+
522
+ // windows settings - we will need to alter for other platforms.
523
+ settingsIcon . setAttribute ( 'href' , 'duck://settings/duckplayer' )
527
524
}
528
525
}
529
526
Original file line number Diff line number Diff line change @@ -31,20 +31,6 @@ export class DuckPlayerPageMessages {
31
31
return this . messaging . request ( 'getUserValues' )
32
32
}
33
33
34
- /**
35
- * This occurs when a user has clicked on the 'Settings Cog'
36
- *
37
- * **OpenSettings example**
38
- * ```json
39
- * { "target": "duckplayer" }
40
- * ```
41
- *
42
- * @param {OpenSettings } openSettings
43
- */
44
- openSettings ( openSettings ) {
45
- this . messaging . notify ( 'openSettings' , openSettings )
46
- }
47
-
48
34
/**
49
35
* This is a subscription that we set up when the page loads.
50
36
* We use this value to show/hide the checkboxes.
@@ -77,7 +63,7 @@ export class DuckPlayerPageMessages {
77
63
}
78
64
79
65
/**
80
- * This data structure is sent to enable settings to be updated
66
+ * This data structure is sent to enable user settings to be updated
81
67
*
82
68
* ```js
83
69
* [[include:packages/special-pages/pages/duckplayer/src/js/messages.example.js]]```
@@ -105,13 +91,3 @@ export class UserValues {
105
91
this . overlayInteracted = params . overlayInteracted
106
92
}
107
93
}
108
-
109
- export class OpenSettings {
110
- /**
111
- * @param {object } params
112
- * @param {"duckplayer" } params.target
113
- */
114
- constructor ( params ) {
115
- this . target = params . target
116
- }
117
- }
Original file line number Diff line number Diff line change @@ -60,8 +60,7 @@ test.describe('duckplayer toolbar', () => {
60
60
await duckplayer . hasLoadedIframe ( )
61
61
62
62
await page . mouse . move ( 1 , 1 )
63
- await duckplayer . clickToOpenSettings ( )
64
- await duckplayer . didOpenSettingsInNewPage ( page )
63
+ await duckplayer . opensSettingsInNewTab ( )
65
64
} )
66
65
test ( 'opening in youtube' , async ( { page } , workerInfo ) => {
67
66
const duckplayer = DuckPlayerPage . create ( page , workerInfo )
Original file line number Diff line number Diff line change @@ -141,25 +141,18 @@ export class DuckPlayerPage {
141
141
await expect ( this . page . locator ( '.info-icon-tooltip' ) ) . toBeHidden ( )
142
142
}
143
143
144
- async clickToOpenSettings ( ) {
144
+ async opensSettingsInNewTab ( ) {
145
+ // duck:// scheme will fail, but we can assert that it was tried and grab the URL
146
+ const failure = new Promise ( resolve => {
147
+ this . page . context ( ) . on ( 'requestfailed' , f => {
148
+ resolve ( f . url ( ) )
149
+ } )
150
+ } )
151
+
145
152
await this . page . locator ( '.open-settings' ) . click ( )
146
- }
147
153
148
- /**
149
- * @param {import("@playwright/test").Page } otherPage
150
- */
151
- async didOpenSettingsInNewPage ( otherPage ) {
152
- const calls = await this . mocks . waitForCallCount ( { method : 'openSettings' , count : 1 } )
153
- expect ( calls [ 0 ] ) . toMatchObject ( {
154
- payload : {
155
- context : 'specialPages' ,
156
- featureName : 'duckPlayerPage' ,
157
- method : 'openSettings' ,
158
- params : {
159
- target : 'duckplayer'
160
- }
161
- }
162
- } )
154
+ // this is for windows, we'll need to support more
155
+ expect ( await failure ) . toEqual ( 'duck://settings/duckplayer' )
163
156
}
164
157
165
158
async clickPlayOnYouTube ( ) {
You can’t perform that action at this time.
0 commit comments