Skip to content

Commit

Permalink
Add test case for ant-design#5494
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Mar 27, 2017
1 parent 6530e76 commit 4393fcf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions components/locale-provider/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,29 @@ describe('Locale Provider', () => {
expect(DatePickerPlaceholder).toBe(locale.DatePicker.lang.placeholder);
});
});

it('should change locale of Modal.xxx', () => {
class ModalDemo extends React.Component {
componentDidMount() {
Modal.confirm({
title: 'Hello World!',
});
}
render() {
return null;
}
}
[enUS, ptBR, ruRU, esES, svSE, frBE, deDE, nlNL, caES, csCZ, koKR].forEach((locale) => {
mount(
<LocaleProvider locale={locale}>
<ModalDemo />
</LocaleProvider>
);
const currentConfirmNode = document.querySelectorAll('.ant-confirm')[document.querySelectorAll('.ant-confirm').length - 1];
const cancelButtonText = currentConfirmNode.querySelectorAll('.ant-btn:not(.ant-btn-primary) span')[0].innerHTML;
const okButtonText = currentConfirmNode.querySelectorAll('.ant-btn-primary span')[0].innerHTML;
expect(cancelButtonText).toBe(locale.Modal.cancelText);
expect(okButtonText).toBe(locale.Modal.okText);
});
});
});

0 comments on commit 4393fcf

Please sign in to comment.