Changeset 11114 for trunk/tests/phpunit/testcases/core/class-bp-button.php
- Timestamp:
- 09/19/2016 02:40:27 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/class-bp-button.php
r9819 r11114 163 163 $GLOBALS['members_template'] = null; 164 164 } 165 166 /** 167 * @ticket BP7226 168 */ 169 public function test_bp_button_new_args() { 170 $b = new BP_Button( array( 171 'id' => 'foo', 172 'component' => 'members', 173 'block_self' => false, 174 'must_be_logged_in' => false, 175 'parent_element' => 'section', 176 'parent_attr' => array( 177 'class' => 'section-class', 178 'id' => 'section-id', 179 'data-parent' => 'foo', 180 ), 181 'button_element' => 'button', 182 'button_attr' => array( 183 'autofocus' => 'autofocus', 184 'type' => 'submit', 185 'name' => 'my-button' 186 ) 187 ) ); 188 189 $this->assertNotFalse( strpos( $b->contents, '<section ' ) ); 190 $this->assertNotFalse( strpos( $b->contents, 'class="section-class ' ) ); 191 $this->assertNotFalse( strpos( $b->contents, 'id="section-id"' ) ); 192 $this->assertNotFalse( strpos( $b->contents, 'data-parent="foo"' ) ); 193 $this->assertNotFalse( strpos( $b->contents, '<button ' ) ); 194 $this->assertNotFalse( strpos( $b->contents, 'autofocus="autofocus"' ) ); 195 $this->assertNotFalse( strpos( $b->contents, 'type="submit"' ) ); 196 $this->assertNotFalse( strpos( $b->contents, 'name="my-button"' ) ); 197 } 198 199 /** 200 * @ticket BP7226 201 */ 202 public function test_bp_button_deprecated_args_should_still_render() { 203 $b = new BP_Button( array( 204 'id' => 'foo', 205 'component' => 'members', 206 'block_self' => false, 207 'must_be_logged_in' => false, 208 'wrapper' => 'section', 209 'wrapper_class' => 'section-class', 210 'wrapper_id' => 'section-id', 211 'link_href' => 'http://example.com', 212 'link_class' => 'link-class', 213 'link_id' => 'link-id', 214 'link_rel' => 'nofollow', 215 'link_title' => 'link-title' 216 ) ); 217 218 $this->assertNotFalse( strpos( $b->contents, '<section ' ) ); 219 $this->assertNotFalse( strpos( $b->contents, 'class="section-class ' ) ); 220 $this->assertNotFalse( strpos( $b->contents, 'id="section-id"' ) ); 221 $this->assertNotFalse( strpos( $b->contents, 'href="http://example.com"' ) ); 222 $this->assertNotFalse( strpos( $b->contents, 'class="link-class"' ) ); 223 $this->assertNotFalse( strpos( $b->contents, 'id="link-id"' ) ); 224 $this->assertNotFalse( strpos( $b->contents, 'rel="nofollow"' ) ); 225 $this->assertNotFalse( strpos( $b->contents, 'title="link-title"' ) ); 226 } 227 228 /** 229 * @ticket BP7226 230 */ 231 public function test_bp_button_new_element_attrs_have_precedence_over_deprecated_element_attrs() { 232 $b = new BP_Button( array( 233 'id' => 'foo', 234 'component' => 'members', 235 'block_self' => false, 236 'must_be_logged_in' => false, 237 'button_element' => 'button', 238 'button_attr' => array( 239 'class' => 'new-class', 240 ), 241 'link_class' => 'old-class' 242 ) ); 243 244 $this->assertNotFalse( strpos( $b->contents, '<button class="new-class"' ) ); 245 } 246 247 /** 248 * @ticket BP7226 249 */ 250 public function test_bp_button_new_element_attrs_should_not_render_for_empty_attrs() { 251 $b = new BP_Button( array( 252 'id' => 'foo', 253 'component' => 'members', 254 'block_self' => false, 255 'must_be_logged_in' => false, 256 'button_element' => 'button', 257 'button_attr' => array( 258 'class' => '', 259 ), 260 ) ); 261 262 $this->assertFalse( strpos( $b->contents, '<button class=""' ) ); 263 } 165 264 }
Note: See TracChangeset
for help on using the changeset viewer.