Fix dataset check in JS (#20733)

* Fix dataset check in JS

* Email opt in quick fix

* Change test
This commit is contained in:
Ben Halpern 2024-03-05 17:11:07 -05:00 committed by GitHub
parent 751e9d70d2
commit f263e17a1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -13,8 +13,7 @@ export class FollowTags extends Component {
this.handleComplete = this.handleComplete.bind(this);
const emailState =
document.body.dataset.defaultEmailOptinAllowed === 'true';
document.body.dataset.default_email_optin_allowed === 'true';
this.state = {
allTags: [],
selectedTags: [],

View file

@ -235,7 +235,7 @@ describe('FollowTags', () => {
describe('emailDigestPeriodic state initialization', () => {
it('should initialize email_digest_periodic to true when data-default-email-optin-allowed is true', async () => {
// Simulate setting data-default-email-optin-allowed to true
document.body.dataset.defaultEmailOptinAllowed = 'true';
document.body.dataset.default_email_optin_allowed = 'true';
const { container } = renderFollowTags();
const checkbox = container.querySelector('#email_digest_periodic');
@ -246,7 +246,7 @@ describe('FollowTags', () => {
it('should initialize email_digest_periodic to false when data-default-email-optin-allowed is false', async () => {
// Simulate setting data-default-email-optin-allowed to false
document.body.dataset.defaultEmailOptinAllowed = 'false';
document.body.dataset.default_email_optin_allowed = 'false';
const { container } = renderFollowTags();
const checkbox = container.querySelector('#email_digest_periodic');