Skip to content
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

Refactor create test form #80

Merged
merged 4 commits into from
Mar 22, 2024
Merged

Conversation

jhonatan-lopes
Copy link
Collaborator

Fixes #79.

Modifies CreateAbTestForm and the respective add_form view so that the template is rendered via Wagtail's panels. This ensures visual consistency with current Wagtail UX/UI and also simplifies the template.

The React component responsible for choosing a page and a goal has also been updated with the 5.X styling.

image

@jhonatan-lopes
Copy link
Collaborator Author

We need to re-run the CI once #77 and #78 are merged as this will only work on Wagtail >= 5

Copy link

codecov bot commented Mar 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.44%. Comparing base (91d0e0c) to head (7e5bb95).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #80      +/-   ##
==========================================
+ Coverage   88.40%   88.44%   +0.04%     
==========================================
  Files          15       15              
  Lines         750      753       +3     
  Branches      140      140              
==========================================
+ Hits          663      666       +3     
  Misses         51       51              
  Partials       36       36              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

</div>
);
};

export function initGoalSelector() {
const goalSelectorProps = JSON.parse(document.getElementById('data-goal-selector-props')?.textContent || '');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fall back to an empty object instead of an empty string, otherwise JSON.parse will crash with SyntaxError: Unexpected end of JSON input.

Suggested change
const goalSelectorProps = JSON.parse(document.getElementById('data-goal-selector-props')?.textContent || '');
const goalSelectorProps = JSON.parse(document.getElementById('data-goal-selector-props')?.textContent || '{}');

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Stormheg Stormheg force-pushed the feature/79-refactor-create-test-form branch from 3a60cfb to 1a6a056 Compare March 22, 2024 13:26
@Stormheg Stormheg force-pushed the feature/79-refactor-create-test-form branch from 1a6a056 to 7e5bb95 Compare March 22, 2024 13:30
@Stormheg Stormheg merged commit 67945f9 into main Mar 22, 2024
11 checks passed
@Stormheg Stormheg deleted the feature/79-refactor-create-test-form branch March 22, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor "Create an A/B test" form to work with wagtail >= 5.0
2 participants