Commit 35c28032 authored by mfluharty's avatar mfluharty

Changes from review feedback

Full sentences approach for summary text i18n
Add spec to check that feature flag is pushed
Shorten a few names
parent a967f52b
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
hasRecentFailures(summary) { hasRecentFailures(summary) {
return this.glFeatures.testFailureHistory && summary?.recentlyFailed > 0; return this.glFeatures.testFailureHistory && summary?.recentlyFailed > 0;
}, },
getRecentFailuresText(summary) { recentFailuresText(summary) {
return recentFailuresTextBuilder(summary); return recentFailuresTextBuilder(summary);
}, },
getReportIcon(report) { getReportIcon(report) {
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
</gl-button> </gl-button>
</template> </template>
<template v-if="hasRecentFailures(summary)" #subHeading> <template v-if="hasRecentFailures(summary)" #subHeading>
{{ getRecentFailuresText(summary) }} {{ recentFailuresText(summary) }}
</template> </template>
<template #body> <template #body>
<div class="mr-widget-grouped-section report-block"> <div class="mr-widget-grouped-section report-block">
...@@ -156,7 +156,7 @@ export default { ...@@ -156,7 +156,7 @@ export default {
<div class="gl-display-inline-flex gl-flex-direction-column"> <div class="gl-display-inline-flex gl-flex-direction-column">
<div>{{ reportText(report) }}</div> <div>{{ reportText(report) }}</div>
<div v-if="hasRecentFailures(report.summary)"> <div v-if="hasRecentFailures(report.summary)">
{{ getRecentFailuresText(report.summary) }} {{ recentFailuresText(report.summary) }}
</div> </div>
</div> </div>
</template> </template>
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
}, },
}, },
computed: { computed: {
shouldShowRecentFailures() { showRecentFailures() {
return this.glFeatures.testFailureHistory && this.issue.recent_failures; return this.glFeatures.testFailureHistory && this.issue.recent_failures;
}, },
}, },
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
@click="openModal({ issue })" @click="openModal({ issue })"
> >
<gl-badge v-if="isNew" variant="danger" class="gl-mr-2">{{ s__('New') }}</gl-badge> <gl-badge v-if="isNew" variant="danger" class="gl-mr-2">{{ s__('New') }}</gl-badge>
<gl-badge v-if="shouldShowRecentFailures" variant="warning" class="gl-mr-2"> <gl-badge v-if="showRecentFailures" variant="warning" class="gl-mr-2">
{{ recentFailuresText(issue.recent_failures) }} {{ recentFailuresText(issue.recent_failures) }}
</gl-badge> </gl-badge>
{{ issue.name }} {{ issue.name }}
......
...@@ -52,16 +52,22 @@ export const recentFailuresTextBuilder = (summary = {}) => { ...@@ -52,16 +52,22 @@ export const recentFailuresTextBuilder = (summary = {}) => {
const { failed, recentlyFailed } = summary; const { failed, recentlyFailed } = summary;
if (!failed || !recentlyFailed) return ''; if (!failed || !recentlyFailed) return '';
const failedString = n__('%d failed test', '%d failed tests', failed); if (failed < 2) {
const recentOutOfFailedString = n__( return sprintf(
sprintf('%d out of %{failedString} has failed', { failedString }), __(
sprintf('%d out of %{failedString} have failed', { failedString }), '%{recentlyFailed} out of %{failed} failed test has failed more than once in the last 14 days',
recentlyFailed, ),
{ recentlyFailed, failed },
);
}
return sprintf(
n__(
'%{recentlyFailed} out of %{failed} failed tests has failed more than once in the last 14 days',
'%{recentlyFailed} out of %{failed} failed tests have failed more than once in the last 14 days',
recentlyFailed,
),
{ recentlyFailed, failed },
); );
return sprintf(s__(`Reports|%{recentOutOfFailedString} more than once in the last 14 days`), {
recentOutOfFailedString,
});
}; };
export const countRecentlyFailedTests = subject => { export const countRecentlyFailedTests = subject => {
......
...@@ -195,11 +195,6 @@ msgid_plural "%d failed security jobs" ...@@ -195,11 +195,6 @@ msgid_plural "%d failed security jobs"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "%d failed test"
msgid_plural "%d failed tests"
msgstr[0] ""
msgstr[1] ""
msgid "%d fixed test result" msgid "%d fixed test result"
msgid_plural "%d fixed test results" msgid_plural "%d fixed test results"
msgstr[0] "" msgstr[0] ""
...@@ -712,6 +707,14 @@ msgstr "" ...@@ -712,6 +707,14 @@ msgstr ""
msgid "%{primary} (%{secondary})" msgid "%{primary} (%{secondary})"
msgstr "" msgstr ""
msgid "%{recentlyFailed} out of %{failed} failed test has failed more than once in the last 14 days"
msgstr ""
msgid "%{recentlyFailed} out of %{failed} failed tests has failed more than once in the last 14 days"
msgid_plural "%{recentlyFailed} out of %{failed} failed tests have failed more than once in the last 14 days"
msgstr[0] ""
msgstr[1] ""
msgid "%{ref} cannot be added: %{error}" msgid "%{ref} cannot be added: %{error}"
msgstr "" msgstr ""
...@@ -22698,9 +22701,6 @@ msgstr "" ...@@ -22698,9 +22701,6 @@ msgstr ""
msgid "Reports|%{combinedString} and %{resolvedString}" msgid "Reports|%{combinedString} and %{resolvedString}"
msgstr "" msgstr ""
msgid "Reports|%{recentOutOfFailedString} more than once in the last 14 days"
msgstr ""
msgid "Reports|Accessibility scanning detected %d issue for the source branch only" msgid "Reports|Accessibility scanning detected %d issue for the source branch only"
msgid_plural "Reports|Accessibility scanning detected %d issues for the source branch only" msgid_plural "Reports|Accessibility scanning detected %d issues for the source branch only"
msgstr[0] "" msgstr[0] ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment