From 781b85e71ff3289508acd5df66beb5a3d46c2198 Mon Sep 17 00:00:00 2001 From: civilx64 <26513472+civilx64@users.noreply.github.com> Date: Sun, 8 Sep 2024 17:57:21 -0400 Subject: [PATCH] add formatting for displaying results of alignment continuity formatting --- frontend/src/GherkinResult.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/GherkinResult.js b/frontend/src/GherkinResult.js index 8210130..d10dcaa 100644 --- a/frontend/src/GherkinResult.js +++ b/frontend/src/GherkinResult.js @@ -32,6 +32,13 @@ function unsafe_format(obj) { } else if (typeof obj == 'object' && 'oneOf' in obj) { let ctx = obj.context ? `${obj.context.charAt(0).toUpperCase()}${obj.context.slice(1)} one of:` : `One of:` return
{ctx}
+ } else if (typeof obj== 'object' && 'num_digits' in obj) { + // custom formatting for calculated alignment consistency (e.g. ALS016, ALS017, ALS018) + console.log(`object is ${obj.expected}`); + let ctx = obj.context ? `${obj.context.charAt(0).toUpperCase()}${obj.context.slice(1)} :` : `One of:` + let value = obj.expected || obj.observed; + let display_value = value.toExponential(obj.num_digits); + return
{ctx} {display_value}
} else { return JSON.stringify(obj); }