Skip to content

Commit f3a8cbd

Browse files
committed
Tests: Expect attribute_name in Interactivity API directive entries.
Follow-up to r64878. Props jonsurrell, ntsekouras, luisherranz. git-svn-id: https://develop.svn.wordpress.org/trunk@64881 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c8378b8 commit f3a8cbd

1 file changed

Lines changed: 50 additions & 40 deletions

File tree

‎tests/phpunit/tests/interactivity-api/wpInteractivityAPI.php‎

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,28 +1112,31 @@ public function test_get_directive_entries() {
11121112
$this->assertCount( 3, $results );
11131113
$this->assertSame(
11141114
array(
1115-
'namespace' => 'myPlugin',
1116-
'value' => 'value-a',
1117-
'suffix' => null,
1118-
'unique_id' => 'plugin-a',
1115+
'namespace' => 'myPlugin',
1116+
'value' => 'value-a',
1117+
'suffix' => null,
1118+
'unique_id' => 'plugin-a',
1119+
'attribute_name' => 'data-wp-test---plugin-a',
11191120
),
11201121
$results[0]
11211122
);
11221123
$this->assertSame(
11231124
array(
1124-
'namespace' => 'myPlugin',
1125-
'value' => 'value-b',
1126-
'suffix' => null,
1127-
'unique_id' => 'plugin-b',
1125+
'namespace' => 'myPlugin',
1126+
'value' => 'value-b',
1127+
'suffix' => null,
1128+
'unique_id' => 'plugin-b',
1129+
'attribute_name' => 'data-wp-test---plugin-b',
11281130
),
11291131
$results[1]
11301132
);
11311133
$this->assertSame(
11321134
array(
1133-
'namespace' => 'myPlugin',
1134-
'value' => 'value-c',
1135-
'suffix' => null,
1136-
'unique_id' => 'plugin-c',
1135+
'namespace' => 'myPlugin',
1136+
'value' => 'value-c',
1137+
'suffix' => null,
1138+
'unique_id' => 'plugin-c',
1139+
'attribute_name' => 'data-wp-test---plugin-c',
11371140
),
11381141
$results[2]
11391142
);
@@ -1152,37 +1155,41 @@ public function test_get_directive_entries() {
11521155
$this->assertCount( 4, $results );
11531156
$this->assertSame(
11541157
array(
1155-
'namespace' => 'myPlugin',
1156-
'value' => 'value1',
1157-
'suffix' => 'suffix-a',
1158-
'unique_id' => 'id-1',
1158+
'namespace' => 'myPlugin',
1159+
'value' => 'value1',
1160+
'suffix' => 'suffix-a',
1161+
'unique_id' => 'id-1',
1162+
'attribute_name' => 'data-wp-test--suffix-a---id-1',
11591163
),
11601164
$results[0]
11611165
);
11621166
$this->assertSame(
11631167
array(
1164-
'namespace' => 'myPlugin',
1165-
'value' => 'value2',
1166-
'suffix' => 'suffix-a',
1167-
'unique_id' => 'id-2',
1168+
'namespace' => 'myPlugin',
1169+
'value' => 'value2',
1170+
'suffix' => 'suffix-a',
1171+
'unique_id' => 'id-2',
1172+
'attribute_name' => 'data-wp-test--suffix-a---id-2',
11681173
),
11691174
$results[1]
11701175
);
11711176
$this->assertSame(
11721177
array(
1173-
'namespace' => 'myPlugin',
1174-
'value' => 'value3',
1175-
'suffix' => 'suffix-b',
1176-
'unique_id' => 'id-1',
1178+
'namespace' => 'myPlugin',
1179+
'value' => 'value3',
1180+
'suffix' => 'suffix-b',
1181+
'unique_id' => 'id-1',
1182+
'attribute_name' => 'data-wp-test--suffix-b---id-1',
11771183
),
11781184
$results[2]
11791185
);
11801186
$this->assertSame(
11811187
array(
1182-
'namespace' => 'myPlugin',
1183-
'value' => 'value4',
1184-
'suffix' => 'suffix-c',
1185-
'unique_id' => 'id-1',
1188+
'namespace' => 'myPlugin',
1189+
'value' => 'value4',
1190+
'suffix' => 'suffix-c',
1191+
'unique_id' => 'id-1',
1192+
'attribute_name' => 'data-wp-test--suffix-c---id-1',
11861193
),
11871194
$results[3]
11881195
);
@@ -1208,19 +1215,21 @@ public function test_get_directive_entries() {
12081215
$this->assertCount( 2, $results );
12091216
$this->assertSame(
12101217
array(
1211-
'namespace' => 'namespace-a',
1212-
'value' => 'value1',
1213-
'suffix' => null,
1214-
'unique_id' => 'id-a',
1218+
'namespace' => 'namespace-a',
1219+
'value' => 'value1',
1220+
'suffix' => null,
1221+
'unique_id' => 'id-a',
1222+
'attribute_name' => 'data-wp-test---id-a',
12151223
),
12161224
$results[0]
12171225
);
12181226
$this->assertSame(
12191227
array(
1220-
'namespace' => 'namespace-b',
1221-
'value' => 'value2',
1222-
'suffix' => null,
1223-
'unique_id' => 'id-b',
1228+
'namespace' => 'namespace-b',
1229+
'value' => 'value2',
1230+
'suffix' => null,
1231+
'unique_id' => 'id-b',
1232+
'attribute_name' => 'data-wp-test---id-b',
12241233
),
12251234
$results[1]
12261235
);
@@ -1266,10 +1275,11 @@ function ( $d ) {
12661275
$this->assertSame(
12671276
array(
12681277
array(
1269-
'namespace' => 'myPlugin',
1270-
'value' => 'kept',
1271-
'suffix' => 'valid',
1272-
'unique_id' => null,
1278+
'namespace' => 'myPlugin',
1279+
'value' => 'kept',
1280+
'suffix' => 'valid',
1281+
'unique_id' => null,
1282+
'attribute_name' => 'data-wp-test--valid',
12731283
),
12741284
),
12751285
$get_directive_entries->invoke( $this->interactivity, $p, 'test' )

0 commit comments

Comments
 (0)