-
Notifications
You must be signed in to change notification settings - Fork 61
Add snapshots for EColorPicker and EDatePicker #896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -45,6 +45,11 @@ describe('An EDatePicker', () => { | |
|
||
const waitForDebounce = () => new Promise((resolve) => setTimeout(resolve, 110)) | ||
|
||
beforeAll(() => { | ||
// prevent "[Vuetify] Unable to locate target [data-app]" warnings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. siehe kommentar oben |
||
document.body.setAttribute('data-app', 'true') | ||
}) | ||
|
||
const mount = (options) => mountComponent(EDatePicker, { vuetify, i18n, ...options }) | ||
|
||
describe.each(localeData)('in locale %s', (locale, data) => { | ||
|
@@ -63,6 +68,21 @@ describe('An EDatePicker', () => { | |
expect(wrapper.find('input[type=text]').element.value).toBe(data.date_1) | ||
}) | ||
|
||
test('looks like a date picker', async () => { | ||
const wrapper = mountComponent({ | ||
data: () => ({ date: DATE_1 }), | ||
template: '<div><e-date-picker v-model="date"></e-date-picker></div>', | ||
components: { 'e-date-picker': EDatePicker } | ||
}, { | ||
vuetify, | ||
i18n | ||
}) | ||
await waitForDebounce() | ||
expect(wrapper).toMatchSnapshot('pickerclosed') | ||
await wrapper.find('button').trigger('click') | ||
expect(document.body).toMatchSnapshot('pickeropen') | ||
}) | ||
|
||
test('updates v-model when the value changes', async () => { | ||
const wrapper = mountComponent({ | ||
data: () => ({ date: DATE_1 }), | ||
|
@@ -99,8 +119,6 @@ describe('An EDatePicker', () => { | |
}) | ||
|
||
test('updates its value when a date is picked', async () => { | ||
// prevent "[Vuetify] Unable to locate target [data-app]" warnings | ||
document.body.setAttribute('data-app', 'true') | ||
const wrapper = mount({ | ||
propsData: { | ||
value: DATE_1 | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -79,10 +79,10 @@ describe('An ETimePicker', () => { | |
vuetify, | ||
i18n | ||
}) | ||
await flushPromises() | ||
await waitForDebounce() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @carlobeltrame that's the reason for |
||
expect(wrapper).toMatchSnapshot('pickerclosed') | ||
await wrapper.find('button').trigger('click') | ||
expect(document.querySelector('body')).toMatchSnapshot('pickeropen') | ||
expect(document.body).toMatchSnapshot('pickeropen') | ||
}) | ||
|
||
test('allows a different valueFormat', async () => { | ||
|
223 changes: 223 additions & 0 deletions
223
frontend/src/components/form/base/__tests__/__snapshots__/EColorPicker.spec.js.snap
This file contains hidden or 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,223 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`An EColorPicker looks like a color picker: pickerclosed 1`] = ` | ||
<div> | ||
<div class="e-form-container" | ||
vee-rules="[object Object]"> | ||
<div class="e-form-container" | ||
value="#ff0000"> | ||
<div class="v-input v-input--hide-details v-input--is-label-active v-input--is-dirty theme--light v-text-field v-text-field--single-line v-text-field--filled v-text-field--is-booted v-text-field--enclosed"> | ||
<div class="v-input__prepend-outer"> | ||
<button type="button" | ||
class="v-icon notranslate v-icon--link mdi mdi-palette theme--light" | ||
style="color: rgb(255, 0, 0); caret-color: #ff0000;"></button> | ||
</div> | ||
<div class="v-input__control"> | ||
<div class="v-input__slot"> | ||
<div class="v-text-field__slot"> | ||
<input id | ||
type="text"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="v-menu"> | ||
<!----> | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`An EColorPicker looks like a color picker: pickeropen 1`] = ` | ||
<body | ||
data-app="true" | ||
> | ||
<div | ||
class="v-menu__content theme--light menuable__content__active " | ||
role="menu" | ||
style="max-height: auto; min-width: 290px; max-width: 290px; top: 12px; left: 0px; transform-origin: top left; z-index: 8; display: none;" | ||
> | ||
|
||
<div | ||
class="v-card v-sheet theme--light" | ||
> | ||
<div | ||
class="v-color-picker v-sheet theme--light v-color-picker--flat theme--light" | ||
style="max-width: 300px;" | ||
> | ||
<div | ||
class="v-color-picker__canvas" | ||
style="width: 300px; height: 150px;" | ||
> | ||
<canvas | ||
height="150" | ||
width="300" | ||
/> | ||
<div | ||
class="v-color-picker__canvas-dot" | ||
style="width: 10px; height: 10px; transform: translate(295px, -5px);" | ||
/> | ||
</div> | ||
<div | ||
class="v-color-picker__controls" | ||
> | ||
<div | ||
class="v-color-picker__preview v-color-picker__preview--hide-alpha" | ||
> | ||
<div | ||
class="v-color-picker__dot" | ||
> | ||
<div | ||
style="background: rgb(255, 0, 0);" | ||
/> | ||
</div> | ||
<div | ||
class="v-color-picker__sliders" | ||
> | ||
<div | ||
class="v-input v-color-picker__hue v-input--hide-details theme--light v-input__slider v-color-picker__track" | ||
> | ||
<div | ||
class="v-input__control" | ||
> | ||
<div | ||
class="v-input__slot" | ||
> | ||
<div | ||
class="v-slider v-slider--horizontal theme--light" | ||
> | ||
<input | ||
disabled="disabled" | ||
id="input-26" | ||
readonly="readonly" | ||
tabindex="-1" | ||
value="0" | ||
/> | ||
<div | ||
class="v-slider__track-container" | ||
> | ||
<div | ||
class="v-slider__track-background primary lighten-3" | ||
style="right: 0px;" | ||
/> | ||
<div | ||
class="v-slider__track-fill primary" | ||
style="left: 0px; width: 0%;" | ||
/> | ||
</div> | ||
<div | ||
aria-orientation="horizontal" | ||
aria-readonly="false" | ||
aria-valuemax="360" | ||
aria-valuemin="0" | ||
aria-valuenow="0" | ||
class="v-slider__thumb-container grey--text text--lighten-2" | ||
role="slider" | ||
style="left: 0%;" | ||
tabindex="0" | ||
> | ||
<div | ||
class="v-slider__thumb grey lighten-2" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
class="v-color-picker__edit" | ||
> | ||
<div | ||
class="v-color-picker__input" | ||
> | ||
<input | ||
max="255" | ||
min="0" | ||
step="1" | ||
type="number" | ||
/> | ||
<span> | ||
R | ||
</span> | ||
</div> | ||
<div | ||
class="v-color-picker__input" | ||
> | ||
<input | ||
max="255" | ||
min="0" | ||
step="1" | ||
type="number" | ||
/> | ||
<span> | ||
G | ||
</span> | ||
</div> | ||
<div | ||
class="v-color-picker__input" | ||
> | ||
<input | ||
max="255" | ||
min="0" | ||
step="1" | ||
type="number" | ||
/> | ||
<span> | ||
B | ||
</span> | ||
</div> | ||
<button | ||
class="v-btn v-btn--icon v-btn--round theme--light v-size--small" | ||
type="button" | ||
> | ||
<span | ||
class="v-btn__content" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="v-icon notranslate mdi mdi-unfold-more-horizontal theme--light" | ||
/> | ||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div | ||
class="spacer" | ||
/> | ||
|
||
<button | ||
class="v-btn v-btn--text theme--light v-size--default primary--text" | ||
data-testid="action-cancel" | ||
type="button" | ||
> | ||
<span | ||
class="v-btn__content" | ||
> | ||
|
||
Abbrechen | ||
|
||
</span> | ||
</button> | ||
|
||
<button | ||
class="v-btn v-btn--text theme--light v-size--default primary--text" | ||
data-testid="action-ok" | ||
type="button" | ||
> | ||
<span | ||
class="v-btn__content" | ||
> | ||
|
||
In Ordnung | ||
|
||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
</body> | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das kann man umgehen, indem man gleich im template <div data-app> setzt.
https://github.com/ecamp/ecamp3/pull/701/files#diff-7eacba905c66292c1fc86af66485b30bb2ee2c01a7106822dd9d48537ec3469cR24
Siehe auch
https://github.com/ecamp/ecamp3/wiki/Frontend#tests-for-components-in-srccomponentsformbase-prefixed-with-e