Skip to content

Commit 530ae7e

Browse files
jeffpauljuanfradkotter
authored
Merge pull request #256 from juanfra/tweak/abilities-test-improvements
Ability test page: Better i18n, add copy functionality. Co-authored-by: juanfra <juanfra@git.wordpress.org> Co-authored-by: dkotter <dkotter@git.wordpress.org>
2 parents 4078cde + 857ccef commit 530ae7e

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

includes/Experiments/Abilities_Explorer/Admin_Page.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,12 @@ private function render_test_runner(): void {
300300
<div class="notice notice-info inline" style="margin: 10px 0;">
301301
<p>
302302
<strong><?php esc_html_e( 'How to test:', 'ai' ); ?></strong><br>
303-
1. <?php esc_html_e( 'Edit the JSON input below with your test data', 'ai' ); ?><br>
304-
2. <?php esc_html_e( 'Click "Validate Input" to check your JSON is correct', 'ai' ); ?><br>
305-
3. <?php esc_html_e( 'Click "Invoke Ability" to execute the ability with your input', 'ai' ); ?><br>
306-
4. <?php esc_html_e( 'View the results below', 'ai' ); ?>
303+
<ol>
304+
<li><?php esc_html_e( 'Edit the JSON input below with your test data', 'ai' ); ?></li>
305+
<li><?php esc_html_e( 'Click "Validate Input" to check your JSON is correct', 'ai' ); ?></li>
306+
<li><?php esc_html_e( 'Click "Invoke Ability" to execute the ability with your input', 'ai' ); ?></li>
307+
<li><?php esc_html_e( 'View the results below', 'ai' ); ?></li>
308+
</ol>
307309
</p>
308310
</div>
309311
<?php endif; ?>
@@ -333,7 +335,10 @@ private function render_test_runner(): void {
333335
<?php if ( ! empty( $ability['input_schema'] ) ) : ?>
334336
<div class="ability-test-schema">
335337
<h3><?php esc_html_e( 'Input Schema Reference', 'ai' ); ?></h3>
336-
<pre><?php echo esc_html( (string) wp_json_encode( $ability['input_schema'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ); ?></pre>
338+
<div class="ability-schema-wrapper">
339+
<button type="button" class="button button-small ability-copy-btn" data-copy="test-input-schema"><?php esc_html_e( 'Copy', 'ai' ); ?></button>
340+
<pre class="ability-schema-display" id="test-input-schema"><?php echo esc_html( (string) wp_json_encode( $ability['input_schema'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) ); ?></pre>
341+
</div>
337342
</div>
338343
<?php endif; ?>
339344
</div>

src/experiments/abilities-explorer/index.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,14 @@
179179
font-size: 16px;
180180
width: 16px;
181181
height: 16px;
182-
vertical-align: middle;
183182
}
184183
}
185184

185+
.wp-core-ui .button.ability-copy-btn .dashicons {
186+
vertical-align: middle;
187+
line-height: .95;
188+
}
189+
186190
/* Test Runner */
187191
.ability-explorer-test-runner {
188192
max-width: 1200px;

0 commit comments

Comments
 (0)