-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(checkout): CHECKOUT-5006 Changes for formatting date as per store…
… config
- Loading branch information
1 parent
ebecc0b
commit a81656d
Showing
17 changed files
with
160 additions
and
44 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`DynamicInput renders select input with passed props 1`] = `"<select class=\\"form-select optimizedCheckout-form-select\\" data-test=\\"field_33-select\\" id=\\"field_33\\" name=\\"select\\"><option value=\\"\\">Select an option</option><option selected=\\"\\" value=\\"foo\\">Foo</option><option value=\\"foo1\\">Foo1</option></select>"`; | ||
exports[`DynamicInput renders select input with passed props 1`] = `"<select class=\\"form-select optimizedCheckout-form-select\\" data-test=\\"field_33-select\\" id=\\"field_33\\" name=\\"select\\"><option value=\\"\\">Select an option</option><option value=\\"foo\\" selected=\\"\\">Foo</option><option value=\\"foo1\\">Foo1</option></select>"`; | ||
exports[`DynamicInput renders text input for default input with passed props 1`] = `"<input type=\\"text\\" id=\\"field_33\\" name=\\"x\\" class=\\"form-input optimizedCheckout-form-input\\" data-test=\\"field_33-text\\"/>"`; | ||
exports[`DynamicInput renders text input for default input with passed props 1`] = `"<input id=\\"field_33\\" name=\\"x\\" class=\\"form-input optimizedCheckout-form-input\\" type=\\"text\\" data-test=\\"field_33-text\\" value=\\"\\">"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { mount } from 'enzyme'; | ||
import React from 'react'; | ||
|
||
import { getStoreConfig } from '../config/config.mock'; | ||
|
||
import createLocaleContext from './createLocaleContext'; | ||
import withDate from './withDate'; | ||
import LocaleContext, { LocaleContextType } from './LocaleContext'; | ||
|
||
describe('withDate()', () => { | ||
let contextValue: Required<LocaleContextType>; | ||
|
||
beforeEach(() => { | ||
contextValue = createLocaleContext(getStoreConfig()); | ||
}); | ||
|
||
it('injects date prop to inner component', () => { | ||
const Inner = () => <div />; | ||
const Outer = withDate(Inner); | ||
const container = mount( | ||
<LocaleContext.Provider value={ contextValue }> | ||
<Outer /> | ||
</LocaleContext.Provider> | ||
); | ||
|
||
expect(container.find(Inner).prop('date')) | ||
.toEqual(contextValue.date); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { createInjectHoc, InjectHoc } from '../common/hoc'; | ||
|
||
import LocaleContext from './LocaleContext'; | ||
|
||
export interface WithDateProps { | ||
date: { | ||
inputFormat: string; | ||
}; | ||
} | ||
|
||
const withDate: InjectHoc<WithDateProps> = createInjectHoc(LocaleContext, { | ||
displayNamePrefix: 'withDate', | ||
pickProps: (value, key) => key === 'date' && !!value, | ||
}); | ||
|
||
export default withDate; |
Oops, something went wrong.