Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom warning message when leaving creating an SQL question (#34696
) * Update isNavigationAllowed logic to prevent new model creation * Add simple model creation test * Remove identifier * Update comment * Add a test case for saving a new model * Avoid using fetchMock directly in QueryBuilder unit tests * Remove setupCollectionsEndpointsByIds in favor of setupCollectionByIdEndpoint * Add native question test base * Update isNavigationAllowed tests * Make isNavigationAllowed tests pass * Update shouldShowUnsavedChangesWarningForSqlQuery logic to account for new questions * Add a test case to run new native question * Update mock to include individual collection GET endpoint * Add DataSourceSelectors to MockNativeQueryEditor * Update test beforeunload event to reflect new behavior * Use setupCollectionByIdEndpoint instead of modifying setupCollectionsEndpoints * Update failing test * Use serializeCardForUrl * Add a test for native query editing * Do not trigger warning when leaving empty question * Add beforeunload tests for creating new questions * Remove redundant div * Make assertions consistent * Use single resetAllMocks() * Fix post-rebase conflict * Work around Cypress not handling beforeunload-related prompts * Our app registers beforeunload event listener e.g. when editing a native SQL question. * Cypress does not automatically close the browser prompt and does not allow manually * interacting with it (unlike with window.confirm). The test will hang forever with * the prompt displayed and will eventually time out. We need to work around this by * monkey-patching window.addEventListener to ignore beforeunload event handlers. * * @see cypress-io/cypress#2118
- Loading branch information