Skip to content

Commit 94a0788

Browse files
committed
allow testing YAML output for resource validation
1 parent 31d9c94 commit 94a0788

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

assets/js/resources.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ const resourceTemplate = (resource, idx) => `<div class="col-1 ${idx === 0 || id
311311
</div>
312312
<div class="card text-white bg-info rounded-0 ${resource} json-valid">
313313
<div class="card-body">
314-
<p class="card-text d-flex justify-content-between"><span><svg class="svg-inline--fa fa-circle-question fa-fw" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-question" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"></path></svg><!-- <i class="fas fa-circle-question fa-fw"></i> Font Awesome fontawesome.com --> JSON valid</span></p>
314+
<p class="card-text d-flex justify-content-between"><span><svg class="svg-inline--fa fa-circle-question fa-fw" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-question" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"></path></svg><!-- <i class="fas fa-circle-question fa-fw"></i> Font Awesome fontawesome.com --> ${currentResponseType} valid</span></p>
315315
</div>
316316
</div>
317317
<div class="card text-white bg-info rounded-0 ${resource} schema-valid">
@@ -544,6 +544,7 @@ let startTestRunnerBtnLbl = '';
544544
let countryNames = new Intl.DisplayNames( [ 'en' ], { type: 'region' } );
545545
let connectionAttempt = null;
546546
let conn;
547+
let currentResponseType = "JSON";
547548

548549
let messageCounter;
549550
let successfulTests = 0;
@@ -747,6 +748,7 @@ const runTests = () => {
747748
conn.send(
748749
JSON.stringify({
749750
action: 'executeValidation',
751+
responsetype: currentResponseType,
750752
...resourceDataChecks[ index++ ]
751753
})
752754
);
@@ -759,6 +761,7 @@ const runTests = () => {
759761
conn.send(
760762
JSON.stringify({
761763
action: 'executeValidation',
764+
responsetype: currentResponseType,
762765
...resourceDataChecks[ index++ ]
763766
})
764767
);
@@ -872,5 +875,15 @@ $(document).on('click', '#startTestRunnerBtn', () => {
872875
}
873876
});
874877

878+
$( document ).on( 'change', '#APIResponseSelect', ( ev ) => {
879+
$( '.page-loader' ).show();
880+
ReadyToRunTests.PageReady = false;
881+
currentResponseType = ev.currentTarget.value;
882+
console.log( `currentResponseType: ${currentResponseType}` );
883+
setupPage();
884+
ReadyToRunTests.tryEnableBtn();
885+
});
886+
887+
875888
setEndpoints();
876889
loadAsyncData();

0 commit comments

Comments
 (0)