-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/11881 unit input type fix (#11939)
* Add container resource limit tests Add real case scenario for unit input component Add input test for container resource limit Add base unit to unit input test Add blur test for container resource limit and unit input Extend input tests to all cases Add test case with parent passing value and update on emission Update tests Update tests to match emitters * Add emitters for unit input * Accept ID pairing with data suggestion fix Co-authored-by: Phillip Rak <rak.phillip@gmail.com> * Enable tests after fix --------- Co-authored-by: Phillip Rak <rak.phillip@gmail.com>
- Loading branch information
1 parent
2dbcd6c
commit 519e2e3
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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,35 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import ContainerResourceLimit from '@shell/components/ContainerResourceLimit.vue'; | ||
|
||
describe('component: ContainerResourceLimit', () => { | ||
it.each([ | ||
['limitsCpu', 'cpu-limit', '111m', '111'], | ||
['limitsMemory', 'memory-limit', '111Mi', '111'], | ||
['requestsCpu', 'cpu-reservation', '111m', '111'], | ||
['requestsMemory', 'memory-reservation', '111Mi', '111'], | ||
// ['limitsGpu', 'gpu-limit', 1000], // Input does not work atm | ||
])('given value prop key %p as %p should display value %p', (key, id, value, expectation) => { | ||
const wrapper = mount(ContainerResourceLimit, { propsData: { value: { [key]: value } } }); | ||
|
||
const element = wrapper.find(`[data-testid="${ id }"]`).element as HTMLInputElement; | ||
|
||
expect(element.value).toBe(expectation); | ||
}); | ||
|
||
describe.each([ | ||
'cpu-reservation', | ||
'memory-reservation', | ||
'cpu-limit', | ||
'memory-limit', | ||
])('given input %p', (id) => { | ||
it.each(['input', 'blur'])('on %p 123 should display input value 123', async(trigger) => { | ||
const wrapper = mount(ContainerResourceLimit); | ||
const input = wrapper.find(`[data-testid="${ id }"]`); | ||
|
||
await input.setValue('123'); | ||
await input.trigger(trigger); | ||
|
||
expect((input.element as HTMLInputElement).value).toBe('123'); | ||
}); | ||
}); | ||
}); |
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