-
Notifications
You must be signed in to change notification settings - Fork 31
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
Update MHR unit tests - Part 1 #1630
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { DOMWrapper, config } from '@vue/test-utils' | ||
|
||
export const dataTestId = (wrapper) => { | ||
function findByTestId(selector) { | ||
const dataSelector = `[data-test-id='${selector}']` | ||
const element = wrapper.element.querySelector(dataSelector) | ||
return new DOMWrapper(element) | ||
} | ||
|
||
function findInputByTestId(selector) { | ||
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. @cameron-eyds this is the plugin and function to get id+input field. We can run it diretly on the wrapper. Makes tests a bit cleaner. eg. |
||
const dataSelector = `[data-test-id='${selector}']` | ||
const element = wrapper.element.querySelector(dataSelector) | ||
return new DOMWrapper(element).find('input') | ||
} | ||
|
||
return { | ||
findByTestId, | ||
findInputByTestId | ||
} | ||
} | ||
|
||
config.plugins.VueWrapper.install(dataTestId) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './data-test-id' |
Unchanged files with check annotations Beta
const setCollateralValidAndEmit = (valid): void => { | ||
setCollateralValid(valid) | ||
context.emit('setCollateralValid', valid) | ||
} | ||
const setVehicleCollateralOpen = (isOpen): void => { | ||
localState.vehicleCollateralOpen = isOpen | ||
context.emit('collateralOpen', localState.vehicleCollateralOpen || localState.generalCollateralOpen) | ||
} | ||
const setGeneralCollateralOpen = (isOpen): void => { | ||
localState.generalCollateralOpen = isOpen | ||
context.emit('collateralOpen', localState.vehicleCollateralOpen || localState.generalCollateralOpen) | ||
} | ||
const vehiclesValid = (): boolean => { | ||
localState.summaryView = val | ||
}) | ||
watch(() => localState.collateral.vehicleCollateral, (val: VehicleCollateralIF[]) => { | ||
if ((vehiclesValid() || localState.collateral?.generalCollateral?.length > 0 || | ||
registrationType === APIRegistrationTypes.TRANSITION_TAX_LIEN) && | ||
// vehicle collateral is optional for Income Tax registration type |
} | ||
setGeneralCollateral(newGeneralCollateral) | ||
} | ||
emit('closeGenColAmend', true) | ||
} | ||
const resetFormAndData = () => { | ||
emit('closeGenColAmend', true) | ||
} | ||
/** Called when general collateral updates */ |
<p class="ProseMirror pt-3 ma-0"> | ||
<span | ||
style="white-space: pre-wrap;" | ||
v-html="lastGeneralCollateral.descriptionDelete" | ||
/> | ||
</p> | ||
</div> | ||
<p class="ProseMirror pt-3 ma-0"> | ||
<span | ||
style="white-space: pre-wrap;" | ||
v-html="lastGeneralCollateral.descriptionAdd" | ||
/> | ||
</p> | ||
</div> | ||
<p class="pt-3 ma-0 pr-6"> | ||
<span | ||
style="white-space: pre-wrap;" | ||
v-html="item.descriptionDelete" | ||
/> | ||
</p> | ||
</div> | ||
<p class="pt-3 ma-0 pr-6"> | ||
<span | ||
style="white-space: pre-wrap;" | ||
v-html="item.descriptionAdd" | ||
/> | ||
</p> | ||
</div> | ||
> | ||
<span | ||
style="white-space: pre-wrap;" | ||
v-html="item.description" | ||
/> | ||
</p> | ||
</div> | ||
v-if="generalCollateral.length > 0" | ||
class="ma-0" | ||
> | ||
<span v-html="generalCollateral[0].description" /> | ||
</p> | ||
</div> | ||
</v-container> | ||
}) | ||
const initGenColAmend = () => { | ||
emit('initGenColAmend', true) | ||
} | ||
const undo = () => { |
localState.activeIndex = index | ||
localState.addEditInProgress = true | ||
localState.showEditVehicle[index] = true | ||
context.emit('collateralOpen', true) | ||
} | ||
const initAdd = () => { | ||
localState.addEditInProgress = true | ||
localState.showAddVehicle = true | ||
context.emit('collateralOpen', true) | ||
} | ||
const resetData = () => { | ||
localState.addEditInProgress = false | ||
localState.showAddVehicle = false | ||
localState.showEditVehicle = [false] | ||
context.emit('collateralOpen', false) | ||
} | ||
const undo = (index: number): void => { |
:class="{ 'alert-box': setAlert }" | ||
> | ||
<slot name="prependSLot" /> | ||
<p><b>{{ setImportantWord }}:</b> <span v-html="setMsg" /></p> | ||
<slot name="appendSLot" /> | ||
</div> | ||
</template> |
> | ||
<span | ||
class="step__label__text" | ||
v-html="step.text" | ||
/> | ||
</v-btn> | ||
<v-btn | ||
> | ||
<p | ||
class="step__label__text__current" | ||
v-html="step.text" | ||
/> | ||
</v-btn> | ||
</div> |
v-if="subProduct.note" | ||
class="sub-product-note mt-2 ml-8 mb-6" | ||
> | ||
<strong>Note:</strong> <span v-html="subProduct.note" /> | ||
</p> | ||
<v-divider | ||
v-if="index !== subProductConfig.length - 1" |
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.
Is this different from
npm run dev
?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.
vite preview
starts localhost with files from/dist
, whilevite dev
has a hot module reload.