-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a03251
commit 21966fd
Showing
4 changed files
with
104 additions
and
41 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,30 @@ | ||
<template> | ||
<div> | ||
Prediction Model: | ||
<select v-model="model.model" aria-label="Prediction model"> | ||
<option value="AverageModel">Average</option> | ||
<option value="PurdyPointsModel">Purdy Points Model</option> | ||
<option value="VO2MaxModel">V̇O₂ Max Model</option> | ||
<option value="CameronModel">Cameron's Model</option> | ||
<option value="RiegelModel">Riegel's Model</option> | ||
</select> | ||
</div> | ||
<div> | ||
Riegel Exponent: | ||
<decimal-input v-model="model.riegelExponent" aria-label="Riegel exponent" :min="1" :max="1.3" | ||
:digits="2" :step="0.01"/> | ||
(default: 1.06) | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import DecimalInput from '@/components/DecimalInput.vue'; | ||
const model = defineModel({ | ||
type: Object, | ||
default: { | ||
model: 'AverageModel', | ||
riegelExponent: 1.06, | ||
}, | ||
}); | ||
</script> |
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,38 @@ | ||
import { test, expect } from 'vitest'; | ||
import { shallowMount } from '@vue/test-utils'; | ||
import RaceOptions from '@/components/RaceOptions.vue'; | ||
|
||
test('should be initialized to modelValue', () => { | ||
// Initialize component | ||
const wrapper = shallowMount(RaceOptions, { | ||
propsData: { | ||
modelValue: { | ||
model: 'PurdyPointsModel', | ||
riegelExponent: 1.2, | ||
} | ||
}, | ||
}); | ||
|
||
// Assert input fields are correct | ||
expect(wrapper.find('select').element.value).to.equal('PurdyPointsModel'); | ||
expect(wrapper.findComponent({ name: 'decimal-input' }).vm.modelValue).to.equal(1.2); | ||
}); | ||
|
||
test('should update modelValue when inputs are modified', async () => { | ||
// Initialize component | ||
const wrapper = shallowMount(RaceOptions); | ||
|
||
// Update model | ||
await wrapper.find('select').setValue('CameronModel'); | ||
expect(wrapper.vm.modelValue).to.deep.equal({ | ||
model: 'CameronModel', | ||
riegelExponent: 1.06, | ||
}); | ||
|
||
// Update Riegel exponent | ||
await wrapper.findComponent({ name: 'decimal-input' }).setValue(1.3); | ||
expect(wrapper.vm.modelValue).to.deep.equal({ | ||
model: 'CameronModel', | ||
riegelExponent: 1.3, | ||
}); | ||
}); |
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