Skip to content

Commit

Permalink
Merge branch 'main' into react-18
Browse files Browse the repository at this point in the history
  • Loading branch information
staylor committed Apr 9, 2022
2 parents 120b02d + 82c5ad8 commit 61cc139
Show file tree
Hide file tree
Showing 18 changed files with 2,637 additions and 3,106 deletions.
4 changes: 2 additions & 2 deletions __tests__/api/base.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('base tag', () => {

expect(firstTag).toBeInstanceOf(Element);
expect(firstTag.getAttribute).toBeDefined();
expect(firstTag.getAttribute('href')).toEqual('http://mysite.com/public');
expect(firstTag.getAttribute('href')).toBe('http://mysite.com/public');
expect(firstTag.outerHTML).toMatchSnapshot();
});

Expand Down Expand Up @@ -131,7 +131,7 @@ describe('base tag', () => {

expect(firstTag).toBeInstanceOf(Element);
expect(firstTag.getAttribute).toBeDefined();
expect(firstTag.getAttribute('href')).toEqual('http://mysite.com/public');
expect(firstTag.getAttribute('href')).toBe('http://mysite.com/public');
expect(firstTag.outerHTML).toMatchSnapshot();
});

Expand Down
34 changes: 17 additions & 17 deletions __tests__/api/bodyAttributes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ describe('body attributes', () => {

const bodyTag = document.body;

expect(bodyTag.getAttribute('class')).toEqual('myClassName');
expect(bodyTag.getAttribute('tabindex')).toEqual('-1');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('class,tabindex');
expect(bodyTag.getAttribute('class')).toBe('myClassName');
expect(bodyTag.getAttribute('tabindex')).toBe('-1');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBe('class,tabindex');
});

it('sets attributes based on the deepest nested component', () => {
Expand All @@ -78,8 +78,8 @@ describe('body attributes', () => {

const bodyTag = document.body;

expect(bodyTag.getAttribute('lang')).toEqual('ja');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('lang');
expect(bodyTag.getAttribute('lang')).toBe('ja');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBe('lang');
});

it('handles valueless attributes', () => {
Expand All @@ -91,8 +91,8 @@ describe('body attributes', () => {

const bodyTag = document.body;

expect(bodyTag.getAttribute('hidden')).toEqual('true');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('hidden');
expect(bodyTag.getAttribute('hidden')).toBe('true');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBe('hidden');
});

it('clears body attributes that are handled within helmet', () => {
Expand Down Expand Up @@ -127,10 +127,10 @@ describe('body attributes', () => {
const bodyTag = document.body;

expect(bodyTag.getAttribute('hidden')).toBeNull();
expect(bodyTag.getAttribute('lang')).toEqual('ja');
expect(bodyTag.getAttribute('id')).toEqual('body-tag');
expect(bodyTag.getAttribute('title')).toEqual('body tag');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('lang,id,title');
expect(bodyTag.getAttribute('lang')).toBe('ja');
expect(bodyTag.getAttribute('id')).toBe('body-tag');
expect(bodyTag.getAttribute('title')).toBe('body tag');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBe('lang,id,title');
});

it('updates with multiple additions and removals - all new', () => {
Expand All @@ -150,9 +150,9 @@ describe('body attributes', () => {

expect(bodyTag.getAttribute('hidden')).toBeNull();
expect(bodyTag.getAttribute('lang')).toBeNull();
expect(bodyTag.getAttribute('id')).toEqual('body-tag');
expect(bodyTag.getAttribute('title')).toEqual('body tag');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('id,title');
expect(bodyTag.getAttribute('id')).toBe('body-tag');
expect(bodyTag.getAttribute('title')).toBe('body tag');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBe('id,title');
});

describe('initialized outside of helmet', () => {
Expand All @@ -166,7 +166,7 @@ describe('body attributes', () => {

const bodyTag = document.body;

expect(bodyTag.getAttribute('test')).toEqual('test');
expect(bodyTag.getAttribute('test')).toBe('test');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBeNull();
});

Expand All @@ -179,8 +179,8 @@ describe('body attributes', () => {

const bodyTag = document.body;

expect(bodyTag.getAttribute('test')).toEqual('helmet-attr');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('test');
expect(bodyTag.getAttribute('test')).toBe('helmet-attr');
expect(bodyTag.getAttribute(HELMET_ATTRIBUTE)).toBe('test');
});

it('attributes are cleared once managed in helmet', () => {
Expand Down
68 changes: 34 additions & 34 deletions __tests__/api/htmlAttributes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('class')).toEqual('myClassName');
expect(htmlTag.getAttribute('lang')).toEqual('en');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('class,lang');
expect(htmlTag.getAttribute('class')).toBe('myClassName');
expect(htmlTag.getAttribute('lang')).toBe('en');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('class,lang');
});

it('sets attributes based on the deepest nested component', () => {
Expand All @@ -45,8 +45,8 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('lang')).toEqual('ja');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('lang');
expect(htmlTag.getAttribute('lang')).toBe('ja');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('lang');
});

it('handles valueless attributes', () => {
Expand All @@ -60,8 +60,8 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('amp')).toEqual('');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('amp');
expect(htmlTag.getAttribute('amp')).toBe('');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('amp');
});

it('clears html attributes that are handled within helmet', () => {
Expand Down Expand Up @@ -106,10 +106,10 @@ describe('html attributes', () => {
const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('amp')).toBeNull();
expect(htmlTag.getAttribute('lang')).toEqual('ja');
expect(htmlTag.getAttribute('id')).toEqual('html-tag');
expect(htmlTag.getAttribute('title')).toEqual('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('lang,id,title');
expect(htmlTag.getAttribute('lang')).toBe('ja');
expect(htmlTag.getAttribute('id')).toBe('html-tag');
expect(htmlTag.getAttribute('title')).toBe('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('lang,id,title');
});

it('updates with multiple additions and removals - all new', () => {
Expand All @@ -135,9 +135,9 @@ describe('html attributes', () => {

expect(htmlTag.getAttribute('amp')).toBeNull();
expect(htmlTag.getAttribute('lang')).toBeNull();
expect(htmlTag.getAttribute('id')).toEqual('html-tag');
expect(htmlTag.getAttribute('title')).toEqual('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('id,title');
expect(htmlTag.getAttribute('id')).toBe('html-tag');
expect(htmlTag.getAttribute('title')).toBe('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('id,title');
});

describe('initialized outside of helmet', () => {
Expand All @@ -151,7 +151,7 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('test')).toEqual('test');
expect(htmlTag.getAttribute('test')).toBe('test');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBeNull();
});

Expand All @@ -166,8 +166,8 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('test')).toEqual('helmet-attr');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('test');
expect(htmlTag.getAttribute('test')).toBe('helmet-attr');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('test');
});

it('attributes are cleared once managed in helmet', () => {
Expand Down Expand Up @@ -199,9 +199,9 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('class')).toEqual('myClassName');
expect(htmlTag.getAttribute('lang')).toEqual('en');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('class,lang');
expect(htmlTag.getAttribute('class')).toBe('myClassName');
expect(htmlTag.getAttribute('lang')).toBe('en');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('class,lang');
});

it('sets attributes based on the deepest nested component', () => {
Expand All @@ -218,8 +218,8 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('lang')).toEqual('ja');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('lang');
expect(htmlTag.getAttribute('lang')).toBe('ja');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('lang');
});

it('handles valueless attributes', () => {
Expand All @@ -231,8 +231,8 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('amp')).toEqual('true');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('amp');
expect(htmlTag.getAttribute('amp')).toBe('true');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('amp');
});

it('clears html attributes that are handled within helmet', () => {
Expand Down Expand Up @@ -267,10 +267,10 @@ describe('html attributes', () => {
const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('amp')).toBeNull();
expect(htmlTag.getAttribute('lang')).toEqual('ja');
expect(htmlTag.getAttribute('id')).toEqual('html-tag');
expect(htmlTag.getAttribute('title')).toEqual('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('lang,id,title');
expect(htmlTag.getAttribute('lang')).toBe('ja');
expect(htmlTag.getAttribute('id')).toBe('html-tag');
expect(htmlTag.getAttribute('title')).toBe('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('lang,id,title');
});

it('updates with multiple additions and removals - all new', () => {
Expand All @@ -290,9 +290,9 @@ describe('html attributes', () => {

expect(htmlTag.getAttribute('amp')).toBeNull();
expect(htmlTag.getAttribute('lang')).toBeNull();
expect(htmlTag.getAttribute('id')).toEqual('html-tag');
expect(htmlTag.getAttribute('title')).toEqual('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('id,title');
expect(htmlTag.getAttribute('id')).toBe('html-tag');
expect(htmlTag.getAttribute('title')).toBe('html tag');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('id,title');
});

describe('initialized outside of helmet', () => {
Expand All @@ -306,7 +306,7 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('test')).toEqual('test');
expect(htmlTag.getAttribute('test')).toBe('test');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBeNull();
});

Expand All @@ -319,8 +319,8 @@ describe('html attributes', () => {

const htmlTag = document.documentElement;

expect(htmlTag.getAttribute('test')).toEqual('helmet-attr');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toEqual('test');
expect(htmlTag.getAttribute('test')).toBe('helmet-attr');
expect(htmlTag.getAttribute(HELMET_ATTRIBUTE)).toBe('test');
});

it('cleared once it is managed in helmet', () => {
Expand Down
Loading

0 comments on commit 61cc139

Please sign in to comment.