Changeset 38035 for trunk/tests/phpunit/tests/adminbar.php
- Timestamp:
- 07/12/2016 11:18:00 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/adminbar.php
r35246 r38035 133 133 $this->assertEquals( $profile_url, $node_user_info->href ); 134 134 $this->assertEquals( $profile_url, $node_edit_profile->href ); 135 136 135 } 137 136 … … 255 254 } 256 255 256 /** 257 * @ticket 32495 258 * 259 * @dataProvider data_admin_bar_nodes_with_tabindex_meta 260 * 261 * @param array $node_data The data for a node, passed to `WP_Admin_Bar::add_node()`. 262 * @param string $expected_html The expected HTML when admin menu is rendered. 263 */ 264 public function test_admin_bar_with_tabindex_meta( $node_data, $expected_html ) { 265 $admin_bar = new WP_Admin_Bar(); 266 $admin_bar->add_node( $node_data ); 267 $admin_bar_html = get_echo( array( $admin_bar, 'render' ) ); 268 $this->assertContains( $expected_html, $admin_bar_html ); 269 } 270 271 /** 272 * Data provider for test_admin_bar_with_tabindex_meta(). 273 * 274 * @return array { 275 * @type array { 276 * @type array $node_data The data for a node, passed to `WP_Admin_Bar::add_node()`. 277 * @type string $expected_html The expected HTML when admin bar is rendered. 278 * } 279 * } 280 */ 281 public function data_admin_bar_nodes_with_tabindex_meta() { 282 return array( 283 array( 284 // No tabindex. 285 array( 286 'id' => 'test-node', 287 ), 288 '<div class="ab-item ab-empty-item">', 289 ), 290 array( 291 // Empty string. 292 array( 293 'id' => 'test-node', 294 'meta' => array( 'tabindex' => '' ), 295 ), 296 '<div class="ab-item ab-empty-item">', 297 ), 298 array( 299 // Integer 1 as string. 300 array( 301 'id' => 'test-node', 302 'meta' => array( 'tabindex' => '1' ), 303 ), 304 '<div class="ab-item ab-empty-item" tabindex="1">', 305 ), 306 array( 307 // Integer -1 as string. 308 array( 309 'id' => 'test-node', 310 'meta' => array( 'tabindex' => '-1' ), 311 ), 312 '<div class="ab-item ab-empty-item" tabindex="-1">', 313 ), 314 array( 315 // Integer 0 as string. 316 array( 317 'id' => 'test-node', 318 'meta' => array( 'tabindex' => '0' ), 319 ), 320 '<div class="ab-item ab-empty-item" tabindex="0">', 321 ), 322 array( 323 // Integer, 0. 324 array( 325 'id' => 'test-node', 326 'meta' => array( 'tabindex' => 0 ), 327 ), 328 '<div class="ab-item ab-empty-item" tabindex="0">', 329 ), 330 array( 331 // Integer, 2. 332 array( 333 'id' => 'test-node', 334 'meta' => array( 'tabindex' => 2 ), 335 ), 336 '<div class="ab-item ab-empty-item" tabindex="2">', 337 ), 338 array( 339 // Boolean, false 340 array( 341 'id' => 'test-node', 342 'meta' => array( 'tabindex' => false ), 343 ), 344 '<div class="ab-item ab-empty-item">', 345 ), 346 ); 347 } 257 348 }
Note: See TracChangeset
for help on using the changeset viewer.