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 {
hasRecentFailures(summary) {
return this.glFeatures.testFailureHistory && summary?.recentlyFailed > 0;
},
getRecentFailuresText(summary) {
recentFailuresText(summary) {
return recentFailuresTextBuilder(summary);
},
getReportIcon(report) {
......@@ -146,7 +146,7 @@ export default {
</gl-button>
</template>
<template v-if="hasRecentFailures(summary)" #subHeading>
{{ getRecentFailuresText(summary) }}
{{ recentFailuresText(summary) }}
</template>
<template #body>
<div class="mr-widget-grouped-section report-block">
......@@ -156,7 +156,7 @@ export default {
<div class="gl-display-inline-flex gl-flex-direction-column">
<div>{{ reportText(report) }}</div>
<div v-if="hasRecentFailures(report.summary)">
{{ getRecentFailuresText(report.summary) }}
{{ recentFailuresText(report.summary) }}
</div>
</div>
</template>
......
......@@ -27,7 +27,7 @@ export default {
},
},
computed: {
shouldShowRecentFailures() {
showRecentFailures() {
return this.glFeatures.testFailureHistory && this.issue.recent_failures;
},
},
......@@ -52,7 +52,7 @@ export default {
@click="openModal({ issue })"
>
<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) }}
</gl-badge>
{{ issue.name }}
......
......@@ -52,16 +52,22 @@ export const recentFailuresTextBuilder = (summary = {}) => {
const { failed, recentlyFailed } = summary;
if (!failed || !recentlyFailed) return '';
const failedString = n__('%d failed test', '%d failed tests', failed);
const recentOutOfFailedString = n__(
sprintf('%d out of %{failedString} has failed', { failedString }),
sprintf('%d out of %{failedString} have failed', { failedString }),
recentlyFailed,
if (failed < 2) {
return sprintf(
__(
'%{recentlyFailed} out of %{failed} failed test has failed more than once in the last 14 days',
),
{ 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 => {
......
......@@ -195,11 +195,6 @@ msgid_plural "%d failed security jobs"
msgstr[0] ""
msgstr[1] ""
msgid "%d failed test"
msgid_plural "%d failed tests"
msgstr[0] ""
msgstr[1] ""
msgid "%d fixed test result"
msgid_plural "%d fixed test results"
msgstr[0] ""
......@@ -712,6 +707,14 @@ msgstr ""
msgid "%{primary} (%{secondary})"
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}"
msgstr ""
......@@ -22698,9 +22701,6 @@ msgstr ""
msgid "Reports|%{combinedString} and %{resolvedString}"
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_plural "Reports|Accessibility scanning detected %d issues for the source branch only"
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