mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
Wrap phrase for translation and update test
This commit is contained in:
parent
7fc4e8d20a
commit
4b83bda306
@ -63,9 +63,9 @@ function ProjectDetail({ project, i18n }) {
|
||||
let createdBy = '';
|
||||
if (created) {
|
||||
if (summary_fields.created_by && summary_fields.created_by.username) {
|
||||
createdBy = `${formatDateString(created)} ${i18n._(t`by`)} ${
|
||||
summary_fields.created_by.username
|
||||
}`;
|
||||
createdBy = i18n._(
|
||||
t`${formatDateString(created)} by ${summary_fields.created_by.username}`
|
||||
);
|
||||
} else {
|
||||
createdBy = formatDateString(created);
|
||||
}
|
||||
@ -74,9 +74,11 @@ function ProjectDetail({ project, i18n }) {
|
||||
let modifiedBy = '';
|
||||
if (modified) {
|
||||
if (summary_fields.modified_by && summary_fields.modified_by.username) {
|
||||
modifiedBy = `${formatDateString(modified)} ${i18n._(t`by`)} ${
|
||||
summary_fields.modified_by.username
|
||||
}`;
|
||||
modifiedBy = i18n._(
|
||||
t`${formatDateString(modified)} by ${
|
||||
summary_fields.modified_by.username
|
||||
}`
|
||||
);
|
||||
} else {
|
||||
modifiedBy = formatDateString(modified);
|
||||
}
|
||||
|
||||
@ -61,7 +61,22 @@ describe('<ProjectDetail />', () => {
|
||||
});
|
||||
|
||||
test('should render Details', () => {
|
||||
const wrapper = mountWithContexts(<ProjectDetail project={mockProject} />);
|
||||
const wrapper = mountWithContexts(<ProjectDetail project={mockProject} />, {
|
||||
context: {
|
||||
linguiPublisher: {
|
||||
i18n: {
|
||||
_: key => {
|
||||
if (key.values) {
|
||||
Object.entries(key.values).forEach(([k, v]) => {
|
||||
key.id = key.id.replace(new RegExp(`\\{${k}\\}`), v);
|
||||
});
|
||||
}
|
||||
return key.id;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
function assertDetail(label, value) {
|
||||
expect(wrapper.find(`Detail[label="${label}"] dt`).text()).toBe(label);
|
||||
expect(wrapper.find(`Detail[label="${label}"] dd`).text()).toBe(value);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user