stable

Clone or download

Read-only

refactor: Replace $nextTick usage whenever possible

Closes request #38280 Avoid usage of vm.$nextTick whenever possible How to test: No functional change. Unit tests should pass. Why? Using await wrapper.vm.$nextTick() has become a bit of a reflex, but there are shorter ways to do the same thing. 1. When simulating a click, we should use await wrapper.trigger("click"); It waits for Vue to update the DOM in reaction to the click. 2. When setting some data on a component, we should use await wrapper.setData(); It waits for Vue to update the DOM. 3.When setting props, we should use await wrapper.setProps(); It also waits for Vue to update the DOM. 4. When dealing with promises and asynchronous code, we should use await (jest|vi).runOnlyPendingTimersAsync(); For each level of promise, we had to add another $nextTick(). It was not clear how many were needed. This correctly waits until all layers of promise have been settled. It also works for the Artifact modal autocompleter test where we awaited the same promise several times as a work-around. 5. When simulating a sub-component event, we should still use await wrapper.vm.$nextTick() There is no built-in method in @vue/test-utils to await. 6. When we want to assert some loading state is shown, we must still use await wrapper.vm.$nextTick() If we wait for the promise to be resolved, our test will never see the loading state. Change-Id: I308633c5b2a0c4b211a12ecca6f3fd31f3463f70

Modified Files

Name
M plugins/baseline/scripts/baseline/src/components/baseline-content/ContentArtifact.test.js +4 −6 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/baselines-list/DeleteBaselineConfirmationModal.test.js +4 −2 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/common/CollapsableContent.test.ts +2 −4 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/common/DeleteConfirmationModal.test.ts +4 −3 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/comparison/SaveComparisonModal.test.js +5 −4 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/comparison/content/ArtifactComparison.test.js +2 −6 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/comparisons-list/DeleteComparisonConfirmationModal.test.js +4 −2 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/new-baseline/MilestonesSelect.test.js +1 −3 Go to diff View file
M plugins/baseline/scripts/baseline/src/components/new-baseline/NewBaselineModal.test.js +7 −6 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/Criteria/CriterionDate.test.ts +2 −7 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/Criteria/CriterionGlobalText.test.ts +1 −4 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/Criteria/CriterionNumber.test.ts +1 −4 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/Criteria/CriterionOwner.test.ts +3 −5 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/Criteria/CriterionText.test.ts +1 −4 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/SearchContainer.test.ts +12 −14 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/SearchCriteriaPanel.test.ts +1 −4 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/SearchItemModals.test.ts +8 −9 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/SearchResult/Cells/SearchItemDropdown.test.ts +1 −3 Go to diff View file
M plugins/document/scripts/document/components/AdvancedSearch/SearchResult/SearchResultError.test.ts +6 −9 Go to diff View file
M plugins/document/scripts/document/components/EmbeddedDisplay/DisplayEmbedded.test.ts +12 −18 Go to diff View file
M plugins/document/scripts/document/components/Folder/ChildFolder.test.js +3 −3 Go to diff View file
M plugins/document/scripts/document/components/Folder/DragNDrop/DragNDropHandler.test.js +3 −2 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/CopyItem.test.ts +14 −12 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/CutItem.test.ts +10 −11 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/Delete/DeleteAssociatedWikiPageCheckbox.test.ts +11 −16 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/Delete/ModalConfirmDeletion.test.ts +9 −8 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/DownloadFolderAsZip/DownloadFolderAsZip.test.ts +5 −23 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/DropDownMenu.test.ts +7 −22 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/DropDownMenuTreeView.test.ts +2 −5 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewDocument/FileCreationModal.test.ts +2 −7 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewDocument/NewItemModal.test.js +4 −5 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewDocument/PropertiesForCreate/ObsolescenceDatePropertyForCreate.test.ts +1 −3 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewVersion/CreateNewVersionEmbeddedFileModal.test.js +7 −9 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewVersion/FileVersionChangelogModal.test.js +2 −6 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewVersion/History/FileVersionHistory.test.ts +7 −16 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/NewVersion/NewVersionEmptyMenuOptions.test.ts +3 −3 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/PasteItem.test.ts +1 −3 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/PropertiesForCreateOrUpdate/AlwaysThereProperties/DescriptionProperty.test.ts +4 −8 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/PropertiesForCreateOrUpdate/AlwaysThereProperties/TitleProperty.test.ts +12 −34 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/PropertiesForCreateOrUpdate/CustomProperties/CustomPropertyListMultipleValue.test.ts +3 −7 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/PropertiesForCreateOrUpdate/CustomProperties/CustomPropertyListSingleValue.test.ts +2 −10 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/UpdateProperties/FolderDefaultPropertiesForUpdate.test.ts +8 −10 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/UpdateProperties/ObsolescenceDatePropertyForUpdate.test.ts +4 −6 Go to diff View file
M plugins/document/scripts/document/components/Folder/DropDown/UpdateProperties/OtherInformationPropertyForUpdate.test.ts +3 −10 Go to diff View file
M plugins/document/scripts/document/components/Folder/Error/GlobalErrorModal.test.ts +1 −3 Go to diff View file
M plugins/document/scripts/document/components/Folder/Error/ShowErrorDetails.test.ts +5 −11 Go to diff View file
M plugins/document/scripts/document/components/Folder/FolderHeader.test.js +8 −7 Go to diff View file
M plugins/document/scripts/document/components/Folder/ItemTitle/FolderCellTitle.test.ts +13 −19 Go to diff View file
M plugins/document/scripts/document/components/Folder/Permissions/PermissionsSelector.test.js +1 −3 Go to diff View file
M plugins/document/scripts/document/components/Folder/Permissions/PermissionsUpdateModal.test.js +7 −11 Go to diff View file
M plugins/document/scripts/document/components/History/DisplayHistory.test.ts +5 −5 Go to diff View file
M plugins/document/scripts/document/components/History/HistoryLogs.test.ts +12 −13 Go to diff View file
M plugins/document/scripts/document/components/Versions/DisplayVersions.test.ts +3 −3 Go to diff View file
M plugins/document/scripts/document/components/Versions/HistoryVersions.test.ts +7 −11 Go to diff View file
M plugins/document_generation/scripts/tracker-cross-report-action/src/Helpers/use-promise.test.ts +5 −9 Go to diff View file
M plugins/git/scripts/permissions-per-group/src/GitPermissionsTable.test.ts +1 −3 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitLabAdministration.test.ts +4 −12 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/ArtifactClosureModal/ArtifactClosureModal.test.ts +14 −20 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/CreateBranchPrefix/CreateBranchPrefixModal.test.ts +21 −31 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/CreateGitlabLinkModal/CredentialsFormModal.test.ts +23 −33 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/CreateGitlabLinkModal/GitlabRepositoryModal.test.ts +7 −21 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/CreateGitlabLinkModal/ListRepositoriesModal.test.ts +12 −17 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/EditAccessTokenGitlabModal/AccessTokenFormModal.test.ts +16 −22 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/EditAccessTokenGitlabModal/ConfirmReplaceTokenModal.test.ts +7 −14 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/EditAccessTokenGitlabModal/EditAccessTokenGitlabModal.test.ts +5 −15 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/RegenerateGitlabWebhookModal/RegenerateGitlabWebhook.test.ts +10 −17 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/GitlabModal/UnlinkGitlabRepositoryModal/UnlinkRepositoryGitlabModal.test.ts +6 −12 Go to diff View file
M plugins/git/scripts/repositories-list/src/components/folders/CollapsibleFolder.test.ts +1 −2 Go to diff View file
M plugins/git/scripts/repository/src/branch-tag-selector/src/components/BranchesSection.test.ts +3 −2 Go to diff View file
M plugins/git/scripts/repository/src/branch-tag-selector/src/components/TagsSection.test.ts +3 −2 Go to diff View file
M plugins/label/scripts/project-labeled-items/src/LabeledItemsList.test.js +3 −2 Go to diff View file
M plugins/onlyoffice/scripts/siteadmin/src/components/App.test.ts +3 −2 Go to diff View file
M plugins/program_management/scripts/planned-iterations/src/components/Backlog/Iteration/IterationCard.test.ts +1 −3 Go to diff View file
M plugins/program_management/scripts/planned-iterations/src/components/Backlog/Iteration/IterationUserStoryList.test.ts +6 −9 Go to diff View file
M plugins/program_management/scripts/planned-iterations/src/components/Backlog/Iteration/PlannedIterationsSection.test.ts +8 −13 Go to diff View file
M plugins/program_management/scripts/planned-iterations/src/components/Backlog/ToBePlanned/IterationsToBePlannedSection.test.ts +5 −7 Go to diff View file
M plugins/program_management/scripts/program_management/src/components/Backlog/ErrorModal.test.ts +3 −1 Go to diff View file
M plugins/program_management/scripts/program_management/src/components/Backlog/ProgramIncrement/FeatureCardBacklogItems.test.ts +10 −15 Go to diff View file
M plugins/program_management/scripts/program_management/src/components/Backlog/ProgramIncrement/ProgramIncrementCard.test.ts +2 −6 Go to diff View file
M plugins/program_management/scripts/program_management/src/components/Backlog/ProgramIncrement/ProgramIncrementFeatureList.test.ts +4 −2 Go to diff View file
M plugins/program_management/scripts/program_management/src/components/Backlog/ToBePlanned/ToBePlanned.test.ts +3 −1 Go to diff View file
M plugins/program_management/scripts/program_management/src/components/Backlog/ToBePlanned/ToBePlannedBacklogItems.test.ts +9 −14 Go to diff View file
M plugins/projectmilestones/scripts/projectmilestones/src/components/WhatsHotSection/ReleaseBadges/ReleaseBadgesDisplayerIfOpenSprints.test.ts +6 −7 Go to diff View file
M plugins/projectmilestones/scripts/projectmilestones/src/components/WhatsHotSection/ReleaseDescription/Chart/ChartDisplayer.test.ts +6 −9 Go to diff View file
M plugins/projectmilestones/scripts/projectmilestones/src/components/WhatsHotSection/ReleaseDescription/TestManagement/TestManagementDisplayer.test.ts +3 −1 Go to diff View file
M plugins/projectmilestones/scripts/projectmilestones/src/components/WhatsHotSection/ReleaseDisplayer.test.ts +5 −6 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-homepage/src/components/Error/PullRequestErrorModal.test.ts +3 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-homepage/src/components/List/PullRequest/PullRequestLabels.test.ts +3 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-homepage/src/components/List/PullRequestsList.test.ts +11 −9 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Errors/PullRequestErrorModal.test.ts +3 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Labels/PullRequestLabels.test.ts +10 −15 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestAuthor.test.ts +1 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestCIStatus.test.ts +1 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestCheckoutButton.test.ts +1 −4 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestCreationDate.test.ts +1 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestStats.test.ts +1 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Reviewers/PullRequestManageReviewersModal.test.ts +3 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Reviewers/PullRequestReviewerList.test.ts +9 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewThreads.test.ts +1 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Title/PullRequestEditTitleModal.test.ts +5 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Title/PullRequestTitle.test.ts +1 −3 Go to diff View file
M plugins/roadmap/scripts/configure-widget/src/components/App.test.ts +11 −9 Go to diff View file
M plugins/roadmap/scripts/roadmap-widget/src/components/Gantt/ScrollingArea.test.ts +6 −6 Go to diff View file
M plugins/roadmap/scripts/roadmap-widget/src/components/Gantt/Task/BarPopover.test.ts +3 −4 Go to diff View file
M plugins/roadmap/scripts/roadmap-widget/src/store/root-actions.test.ts +9 −15 Go to diff View file
M plugins/taskboard/scripts/taskboard/src/components/GlobalError/ErrorModal.test.ts +1 −2 Go to diff View file
M plugins/taskboard/scripts/taskboard/src/components/GlobalError/GlobalAppError.test.ts +1 −2 Go to diff View file
M plugins/taskboard/scripts/taskboard/src/components/TaskBoard/Body/Swimlane/Card/Add/AddCard.test.ts +3 −6 Go to diff View file
M plugins/taskboard/scripts/taskboard/src/components/TaskBoard/Body/Swimlane/Card/CardAssignees.test.ts +2 −3 Go to diff View file
M plugins/taskboard/scripts/taskboard/src/components/TaskBoard/Body/Swimlane/Card/RemainingEffort/EditRemainingEffort.test.ts +13 −24 Go to diff View file
M plugins/testplan/scripts/test-plan/src/components/BacklogItems/ExportButton.test.ts +17 −25 Go to diff View file
M plugins/testplan/scripts/test-plan/src/components/Campaigns/CreateModal.test.ts +5 −7 Go to diff View file
M plugins/tracker/scripts/lib/artifact-modal/src/adapters/UI/fields/link-field/dropdown/ArtifactLinkSelectorAutoCompleter.test.ts +29 −35 Go to diff View file
M plugins/tracker/scripts/semantics-timeframe/src/components/TimeframeBasedOnFieldsConfig.test.ts +47 −83 Go to diff View file
M plugins/tracker/scripts/semantics-timeframe/src/components/TimeframeImpliedFromAnotherTrackerConfig.test.ts +3 −5 Go to diff View file
M plugins/tracker/scripts/tracker-creation/src/components/steps/step-one/cards/FromJira/TrackerFromJira.test.ts +3 −8 Go to diff View file
M plugins/tracker/scripts/tracker-creation/src/components/steps/step-one/cards/FromJira/TrackerFromJiraProject.test.ts +1 −3 Go to diff View file
M plugins/tracker/scripts/tracker-creation/src/components/steps/step-one/cards/TrackerFromAnotherProject/TrackerFromAnotherProjectSelector.test.ts +2 −3 Go to diff View file
M plugins/tracker/scripts/workflow-transitions/src/components/BaseTrackerWorkflowTransitions.test.js +0 −1 Go to diff View file
M plugins/tracker/scripts/workflow-transitions/src/components/Header/WorkflowFieldChange.test.js +1 −3 Go to diff View file
M plugins/tracker/scripts/workflow-transitions/src/components/TransitionDeleter.test.js +8 −6 Go to diff View file
M plugins/tracker/scripts/workflow-transitions/src/components/TransitionMatrixContent.test.js +3 −1 Go to diff View file
M src/scripts/platform-admin-banner/src/components/App.test.ts +6 −8 Go to diff View file
M src/scripts/project-registration/src/components/Information/Fields/FieldDescription.test.ts +7 −7 Go to diff View file
M src/scripts/project-registration/src/components/Information/ProjectInformation.test.ts +6 −9 Go to diff View file
M src/scripts/project-registration/src/components/Information/ProjectInformationFooter.test.ts +1 −3 Go to diff View file
M src/scripts/project-registration/src/components/Template/Advanced/FromUserExistingProject/FromExistingUserProjectTemplateCard.test.ts +3 −16 Go to diff View file
M src/scripts/project-registration/src/components/Template/TemplateSelection.test.ts +0 −8 Go to diff View file
M src/scripts/project-services/src/components/Service/InEditionCustomService.test.js +1 −2 Go to diff View file