@@ -127,57 +127,65 @@ public function test_perflab_get_admin_pointers(): void {
127
127
*/
128
128
public function data_provider_test_perflab_admin_pointer (): array {
129
129
return array (
130
- 'null ' => array (
130
+ 'null ' => array (
131
131
'initial_wp_pointers ' => '' ,
132
132
'hook_suffix ' => null ,
133
133
'expected ' => false ,
134
134
'dismissed_wp_pointers ' => '' ,
135
135
),
136
- 'edit.php ' => array (
136
+ 'edit.php ' => array (
137
137
'initial_wp_pointers ' => '' ,
138
138
'hook_suffix ' => 'edit.php ' ,
139
139
'expected ' => false ,
140
140
'dismissed_wp_pointers ' => '' ,
141
141
),
142
- 'dashboard_not_dismissed ' => array (
142
+ 'dashboard_not_dismissed ' => array (
143
143
'initial_wp_pointers ' => '' ,
144
144
'hook_suffix ' => 'index.php ' ,
145
145
'expected ' => true ,
146
146
'dismissed_wp_pointers ' => 'perflab-feature-view-transitions ' ,
147
147
),
148
- 'plugins_not_dismissed ' => array (
148
+ 'plugins_not_dismissed ' => array (
149
149
'initial_wp_pointers ' => '' ,
150
150
'hook_suffix ' => 'plugins.php ' ,
151
151
'expected ' => true ,
152
152
'dismissed_wp_pointers ' => 'perflab-feature-view-transitions ' ,
153
153
),
154
- 'dashboard_new_dismissed ' => array (
154
+ 'dashboard_new_dismissed ' => array (
155
155
// Note: If the No-cache BFCache plugin (not part of the monorepo) is installed, then this test will likely fail and it should be skipped.
156
156
'initial_wp_pointers ' => 'perflab-admin-pointer ' ,
157
157
'hook_suffix ' => 'index.php ' ,
158
158
'expected ' => true ,
159
159
'dismissed_wp_pointers ' => 'perflab-admin-pointer,perflab-feature-view-transitions ' ,
160
160
),
161
- 'dashboard_one_dismissed ' => array (
161
+ 'dashboard_last_auto_dismissed ' => array (
162
162
// Note: The No-cache BFCache plugin is not part of the monorepo, so it is not automatically installed in the dev environment.
163
- 'initial_wp_pointers ' => 'perflab-admin-pointer,perflab-feature-nocache-bfcache ' ,
163
+ 'initial_wp_pointers ' => 'perflab-admin-pointer,perflab-feature-nocache-bfcache,perflab-feature-speculation-rules-auth ' ,
164
164
'hook_suffix ' => 'index.php ' ,
165
165
'expected ' => false ,
166
+ 'dismissed_wp_pointers ' => 'perflab-admin-pointer,perflab-feature-nocache-bfcache,perflab-feature-speculation-rules-auth,perflab-feature-view-transitions ' ,
167
+ ),
168
+ 'dashboard_one_not_auto_dismissed ' => array (
169
+ // Note: The No-cache BFCache plugin is not part of the monorepo, so it is not automatically installed in the dev environment.
170
+ // Note: The Speculative Loading admin pointer 'perflab-feature-speculation-rules-auth' does not get auto-dismissed because it is for a new feature of an existing feature plugin.
171
+ 'initial_wp_pointers ' => 'perflab-admin-pointer,perflab-feature-nocache-bfcache ' ,
172
+ 'hook_suffix ' => 'index.php ' ,
173
+ 'expected ' => true ,
166
174
'dismissed_wp_pointers ' => 'perflab-admin-pointer,perflab-feature-nocache-bfcache,perflab-feature-view-transitions ' ,
167
175
),
168
- 'dashboard_all_dismissed ' => array (
176
+ 'dashboard_all_dismissed ' => array (
169
177
'initial_wp_pointers ' => implode ( ', ' , array_keys ( perflab_get_admin_pointers () ) ),
170
178
'hook_suffix ' => 'index.php ' ,
171
179
'expected ' => false ,
172
180
'dismissed_wp_pointers ' => implode ( ', ' , array_keys ( perflab_get_admin_pointers () ) ),
173
181
),
174
- 'perflab_screen_first_time ' => array (
182
+ 'perflab_screen_first_time ' => array (
175
183
'initial_wp_pointers ' => '' ,
176
184
'hook_suffix ' => 'settings_page_ ' . PERFLAB_SCREEN ,
177
185
'expected ' => false ,
178
186
'dismissed_wp_pointers ' => implode ( ', ' , array_keys ( perflab_get_admin_pointers () ) ),
179
187
),
180
- 'perflab_screen_second_time ' => array (
188
+ 'perflab_screen_second_time ' => array (
181
189
'initial_wp_pointers ' => 'perflab-admin-pointer ' ,
182
190
'hook_suffix ' => 'settings_page_ ' . PERFLAB_SCREEN ,
183
191
'expected ' => false ,
@@ -207,14 +215,14 @@ public function test_perflab_admin_pointer( string $initial_wp_pointers, ?string
207
215
if ( $ script_dependency instanceof _WP_Dependency ) {
208
216
$ after_script = implode ( "\n" , array_filter ( $ script_dependency ->extra ['after ' ] ?? array () ) );
209
217
}
218
+ $ this ->assertSame ( $ dismissed_wp_pointers , get_user_meta ( $ user_id , 'dismissed_wp_pointers ' , true ) );
219
+ $ this ->assertSame ( $ expected , wp_script_is ( 'wp-pointer ' , 'enqueued ' ) );
220
+ $ this ->assertSame ( $ expected , wp_style_is ( 'wp-pointer ' , 'enqueued ' ) );
210
221
if ( $ expected ) {
211
222
$ this ->assertStringContainsString ( 'pointerIdsToDismiss ' , $ after_script );
212
223
} else {
213
224
$ this ->assertStringNotContainsString ( 'pointerIdsToDismiss ' , $ after_script );
214
225
}
215
- $ this ->assertSame ( $ expected , wp_script_is ( 'wp-pointer ' , 'enqueued ' ) );
216
- $ this ->assertSame ( $ expected , wp_style_is ( 'wp-pointer ' , 'enqueued ' ) );
217
- $ this ->assertSame ( $ dismissed_wp_pointers , get_user_meta ( $ user_id , 'dismissed_wp_pointers ' , true ) );
218
226
}
219
227
220
228
/**
0 commit comments