From fbf1e61167d16ca2238ca68223b9592d47beb24a Mon Sep 17 00:00:00 2001 From: David Fei Date: Fri, 28 Jul 2023 13:06:30 -0500 Subject: [PATCH 01/12] Coerce attribute names to lower case --- src/api/attributes.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/attributes.ts b/src/api/attributes.ts index 13e9d1e841..5a41228dc8 100644 --- a/src/api/attributes.ts +++ b/src/api/attributes.ts @@ -56,6 +56,9 @@ function getAttr( return elem.attribs; } + // Coerce attribute names to lowercase to match load() and setAttr() behavior + name = name.toLowerCase(); + if (hasOwn.call(elem.attribs, name)) { // Get the (decoded) attribute return !xmlMode && rboolean.test(name) ? name : elem.attribs[name]; @@ -88,6 +91,9 @@ function getAttr( * @param value - The attribute's value. */ function setAttr(el: Element, name: string, value: string | null) { + // Coerce attr names to lowercase to match load() behavior + name = name.toLowerCase(); + if (value === null) { removeAttribute(el, name); } else { From 4c2f2793ea74d48ae1bc747c5859eeee6029a846 Mon Sep 17 00:00:00 2001 From: David Fei Date: Fri, 28 Jul 2023 14:14:27 -0500 Subject: [PATCH 02/12] Refactor to avoid setting parameter variable --- src/api/attributes.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/api/attributes.ts b/src/api/attributes.ts index 5a41228dc8..8b834cd1d1 100644 --- a/src/api/attributes.ts +++ b/src/api/attributes.ts @@ -57,15 +57,17 @@ function getAttr( } // Coerce attribute names to lowercase to match load() and setAttr() behavior - name = name.toLowerCase(); + const lowerCasedName = name.toLowerCase(); - if (hasOwn.call(elem.attribs, name)) { + if (hasOwn.call(elem.attribs, lowerCasedName)) { // Get the (decoded) attribute - return !xmlMode && rboolean.test(name) ? name : elem.attribs[name]; + return !xmlMode && rboolean.test(lowerCasedName) + ? lowerCasedName + : elem.attribs[lowerCasedName]; } // Mimic the DOM and return text content as value for `option's` - if (elem.name === 'option' && name === 'value') { + if (elem.name === 'option' && lowerCasedName === 'value') { return text(elem.children); } @@ -73,7 +75,7 @@ function getAttr( if ( elem.name === 'input' && (elem.attribs['type'] === 'radio' || elem.attribs['type'] === 'checkbox') && - name === 'value' + lowerCasedName === 'value' ) { return 'on'; } @@ -92,12 +94,12 @@ function getAttr( */ function setAttr(el: Element, name: string, value: string | null) { // Coerce attr names to lowercase to match load() behavior - name = name.toLowerCase(); + const lowerCasedName = name.toLowerCase(); if (value === null) { - removeAttribute(el, name); + removeAttribute(el, lowerCasedName); } else { - el.attribs[name] = `${value}`; + el.attribs[lowerCasedName] = `${value}`; } } From 19dde3a9d4a41f4676c48a964f81466a7f8af0a3 Mon Sep 17 00:00:00 2001 From: Brandon Walsh Date: Fri, 28 Jul 2023 15:47:00 -0400 Subject: [PATCH 03/12] Add unit tests for lowercase attribute name support Co-authored-by: rjpatt Co-authored-by: davidfei222 --- src/__fixtures__/fixtures.ts | 2 +- src/__tests__/deprecated.spec.ts | 2 +- src/api/attributes.spec.ts | 23 ++++++++++++++++++++--- src/api/manipulation.spec.ts | 10 ++++++---- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/__fixtures__/fixtures.ts b/src/__fixtures__/fixtures.ts index d60832de72..084d7b4490 100644 --- a/src/__fixtures__/fixtures.ts +++ b/src/__fixtures__/fixtures.ts @@ -2,7 +2,7 @@ export const fruits = [ '
    ', '
  • Apple
  • ', '
  • Orange
  • ', - '
  • Pear
  • ', + '
  • Pear
  • ', '
', ].join(''); diff --git a/src/__tests__/deprecated.spec.ts b/src/__tests__/deprecated.spec.ts index 9aca7c9fc7..04ec77200a 100644 --- a/src/__tests__/deprecated.spec.ts +++ b/src/__tests__/deprecated.spec.ts @@ -172,7 +172,7 @@ describe('deprecated APIs', () => { it('(selector) : should return the outerHTML of the selected element', () => { const $ = cheerio.load(fixtures.fruits); - expect($.html('.pear')).toBe('
  • Pear
  • '); + expect($.html('.pear')).toBe('
  • Pear
  • '); }); }); diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index 79fe03fc57..456377b41f 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -42,6 +42,12 @@ describe('$(...)', () => { expect(attr).toBe('autofocus'); }); + it('(valid key) should get uppercase attribute with lowercase name', () => { + const $pear = $('.pear'); + expect($pear.attr('FOO')).toBe('true'); + expect($pear.attr('foo')).toBe('true'); + }); + it('(key, value) : should set one attr', () => { const $pear = $('.pear').attr('id', 'pear'); expect($('#pear')).toHaveLength(1); @@ -65,6 +71,12 @@ describe('$(...)', () => { expect($src[0]).toBeUndefined(); }); + it('(key, value) should save uppercase attribute name as lowercase', () => { + const $pear = $('.pear').attr('BAR', '100'); + expect($pear.attr('BAR')).toBe('100'); + expect($pear.attr('bar')).toBe('100'); + }); + it('(map) : object map should set multiple attributes', () => { $('.apple').attr({ id: 'apple', @@ -168,19 +180,24 @@ describe('$(...)', () => { }); it('(chaining) setting value and calling attr returns result', () => { + const pearAttr = $('.pear').attr('fizz', 'buzz').attr('fizz'); + expect(pearAttr).toBe('buzz'); + }); + + it('(chaining) overwriting value and calling attr returns result', () => { const pearAttr = $('.pear').attr('foo', 'bar').attr('foo'); expect(pearAttr).toBe('bar'); }); it('(chaining) setting attr to null returns a $', () => { - const $pear = $('.pear').attr('foo', null); + const $pear = $('.pear').attr('bar', null); expect($pear).toBeInstanceOf($); }); it('(chaining) setting attr to undefined returns a $', () => { - const $pear = $('.pear').attr('foo', undefined); + const $pear = $('.pear').attr('bar', undefined); expect($('.pear')).toHaveLength(1); - expect($('.pear').attr('foo')).toBeUndefined(); + expect($('.pear').attr('bar')).toBeUndefined(); expect($pear).toBeInstanceOf($); }); diff --git a/src/api/manipulation.spec.ts b/src/api/manipulation.spec.ts index 9d6fcba3f4..2a60d324fb 100644 --- a/src/api/manipulation.spec.ts +++ b/src/api/manipulation.spec.ts @@ -1729,7 +1729,7 @@ describe('$(...)', () => { [ '
  • Apple
  • ', '
  • Orange
  • ', - '
  • Pear
  • ', + '
  • Pear
  • ', ].join('') ); }); @@ -1777,7 +1777,7 @@ describe('$(...)', () => { it('(elem) : should move the passed element (#940)', () => { $('.apple').html($('.orange')); expect($fruits.html()).toBe( - '
  • Orange
  • Pear
  • ' + '
  • Orange
  • Pear
  • ' ); }); @@ -1809,12 +1809,14 @@ describe('$(...)', () => { describe('.toString', () => { it('() : should get the outerHTML for an element', () => { - expect($fruits.toString()).toBe(fruits); + expect($fruits.toString()).toBe( + '
    • Apple
    • Orange
    • Pear
    ' + ); }); it('() : should return an html string for a set of elements', () => { expect($fruits.find('li').toString()).toBe( - '
  • Apple
  • Orange
  • Pear
  • ' + '
  • Apple
  • Orange
  • Pear
  • ' ); }); From 1bb5a9565aedd3b00e00bd0598158090d6c19721 Mon Sep 17 00:00:00 2001 From: Rachel Patterson Date: Fri, 28 Jul 2023 16:08:20 -0400 Subject: [PATCH 04/12] add second lowercase test case --- src/api/attributes.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index 456377b41f..42dcafa2eb 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -48,6 +48,12 @@ describe('$(...)', () => { expect($pear.attr('foo')).toBe('true'); }); + it('(valid key) should get lowercase attribute with uppercase name', () => { + const $pear = $('.pear'); + expect($pear.attr('CLASS')).toBe('pear'); + expect($pear.attr('class')).toBe('pear'); + }); + it('(key, value) : should set one attr', () => { const $pear = $('.pear').attr('id', 'pear'); expect($('#pear')).toHaveLength(1); From 0ffe2abc5e2912e228388d642a8b89287ad51777 Mon Sep 17 00:00:00 2001 From: Rachel Patterson Date: Fri, 28 Jul 2023 16:42:38 -0400 Subject: [PATCH 05/12] minor wording change for tests --- src/api/attributes.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index 42dcafa2eb..e4f6da335e 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -42,13 +42,13 @@ describe('$(...)', () => { expect(attr).toBe('autofocus'); }); - it('(valid key) should get uppercase attribute with lowercase name', () => { + it('(valid key) should get uppercase attr with lowercase name', () => { const $pear = $('.pear'); expect($pear.attr('FOO')).toBe('true'); expect($pear.attr('foo')).toBe('true'); }); - it('(valid key) should get lowercase attribute with uppercase name', () => { + it('(valid key) should get lowercase attr with uppercase name', () => { const $pear = $('.pear'); expect($pear.attr('CLASS')).toBe('pear'); expect($pear.attr('class')).toBe('pear'); From 35e1ed4465978eac41fc0ac5fec09771d44fddef Mon Sep 17 00:00:00 2001 From: Brandon Walsh Date: Fri, 28 Jul 2023 16:47:12 -0400 Subject: [PATCH 06/12] Edit test name for consistency --- src/api/attributes.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index e4f6da335e..5fcf39b20a 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -77,7 +77,7 @@ describe('$(...)', () => { expect($src[0]).toBeUndefined(); }); - it('(key, value) should save uppercase attribute name as lowercase', () => { + it('(key, value) should save uppercase attr name as lowercase', () => { const $pear = $('.pear').attr('BAR', '100'); expect($pear.attr('BAR')).toBe('100'); expect($pear.attr('bar')).toBe('100'); From 1bdca4d11c8c473d1153307b88514c7c28e0bd96 Mon Sep 17 00:00:00 2001 From: Rachel Patterson Date: Fri, 28 Jul 2023 18:32:08 -0400 Subject: [PATCH 07/12] remove unit test --- src/api/attributes.spec.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index 5fcf39b20a..ef31ac4e0c 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -48,12 +48,6 @@ describe('$(...)', () => { expect($pear.attr('foo')).toBe('true'); }); - it('(valid key) should get lowercase attr with uppercase name', () => { - const $pear = $('.pear'); - expect($pear.attr('CLASS')).toBe('pear'); - expect($pear.attr('class')).toBe('pear'); - }); - it('(key, value) : should set one attr', () => { const $pear = $('.pear').attr('id', 'pear'); expect($('#pear')).toHaveLength(1); From 78b12140c7c9c23830eea1dc740130d7864c4a9f Mon Sep 17 00:00:00 2001 From: Rachel Patterson Date: Fri, 28 Jul 2023 18:32:35 -0400 Subject: [PATCH 08/12] readd unit test --- src/api/attributes.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index ef31ac4e0c..5fcf39b20a 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -48,6 +48,12 @@ describe('$(...)', () => { expect($pear.attr('foo')).toBe('true'); }); + it('(valid key) should get lowercase attr with uppercase name', () => { + const $pear = $('.pear'); + expect($pear.attr('CLASS')).toBe('pear'); + expect($pear.attr('class')).toBe('pear'); + }); + it('(key, value) : should set one attr', () => { const $pear = $('.pear').attr('id', 'pear'); expect($('#pear')).toHaveLength(1); From 30b7b6e815d283baeb4887072c487a5d2402e98a Mon Sep 17 00:00:00 2001 From: David Fei Date: Mon, 31 Jul 2023 12:04:23 -0500 Subject: [PATCH 09/12] Add handling for XML mode --- src/api/attributes.ts | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/api/attributes.ts b/src/api/attributes.ts index 8b834cd1d1..8c944e0480 100644 --- a/src/api/attributes.ts +++ b/src/api/attributes.ts @@ -57,17 +57,18 @@ function getAttr( } // Coerce attribute names to lowercase to match load() and setAttr() behavior - const lowerCasedName = name.toLowerCase(); + // Only do this for HTML since XML is case-sensitive + const nameToUse = xmlMode ? name : name.toLowerCase(); - if (hasOwn.call(elem.attribs, lowerCasedName)) { + if (hasOwn.call(elem.attribs, nameToUse)) { // Get the (decoded) attribute - return !xmlMode && rboolean.test(lowerCasedName) - ? lowerCasedName - : elem.attribs[lowerCasedName]; + return !xmlMode && rboolean.test(nameToUse) + ? nameToUse + : elem.attribs[nameToUse]; } // Mimic the DOM and return text content as value for `option's` - if (elem.name === 'option' && lowerCasedName === 'value') { + if (elem.name === 'option' && nameToUse === 'value') { return text(elem.children); } @@ -75,7 +76,7 @@ function getAttr( if ( elem.name === 'input' && (elem.attribs['type'] === 'radio' || elem.attribs['type'] === 'checkbox') && - lowerCasedName === 'value' + nameToUse === 'value' ) { return 'on'; } @@ -91,15 +92,22 @@ function getAttr( * @param el - The element to set the attribute on. * @param name - The attribute's name. * @param value - The attribute's value. + * @param xmlMode - True if running in XML mode. */ -function setAttr(el: Element, name: string, value: string | null) { +function setAttr( + el: Element, + name: string, + value: string | null, + xmlMode?: boolean +) { // Coerce attr names to lowercase to match load() behavior - const lowerCasedName = name.toLowerCase(); + // Only do this for HTML since XML is case-sensitive + const nameToUse = xmlMode ? name : name.toLowerCase(); if (value === null) { - removeAttribute(el, lowerCasedName); + removeAttribute(el, nameToUse); } else { - el.attribs[lowerCasedName] = `${value}`; + el.attribs[nameToUse] = `${value}`; } } @@ -201,7 +209,13 @@ export function attr( } } return domEach(this, (el, i) => { - if (isTag(el)) setAttr(el, name, value.call(el, i, el.attribs[name])); + if (isTag(el)) + setAttr( + el, + name, + value.call(el, i, el.attribs[name]), + this.options.xmlMode + ); }); } return domEach(this, (el) => { @@ -210,10 +224,10 @@ export function attr( if (typeof name === 'object') { for (const objName of Object.keys(name)) { const objValue = name[objName]; - setAttr(el, objName, objValue); + setAttr(el, objName, objValue, this.options.xmlMode); } } else { - setAttr(el, name as string, value as string); + setAttr(el, name as string, value as string, this.options.xmlMode); } }); } From 345aeb6cf41145cd4c0d09e8f14ecde049319c22 Mon Sep 17 00:00:00 2001 From: David Fei Date: Tue, 1 Aug 2023 08:52:13 -0500 Subject: [PATCH 10/12] Fix linter errors --- src/api/attributes.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/api/attributes.ts b/src/api/attributes.ts index 8c944e0480..dc1535f8ed 100644 --- a/src/api/attributes.ts +++ b/src/api/attributes.ts @@ -56,8 +56,7 @@ function getAttr( return elem.attribs; } - // Coerce attribute names to lowercase to match load() and setAttr() behavior - // Only do this for HTML since XML is case-sensitive + // Coerce attribute names to lowercase to match load() and setAttr() behavior (HTML only) const nameToUse = xmlMode ? name : name.toLowerCase(); if (hasOwn.call(elem.attribs, nameToUse)) { @@ -100,8 +99,7 @@ function setAttr( value: string | null, xmlMode?: boolean ) { - // Coerce attr names to lowercase to match load() behavior - // Only do this for HTML since XML is case-sensitive + // Coerce attr names to lowercase to match load() behavior (HTML only) const nameToUse = xmlMode ? name : name.toLowerCase(); if (value === null) { @@ -209,13 +207,14 @@ export function attr( } } return domEach(this, (el, i) => { - if (isTag(el)) + if (isTag(el)) { setAttr( el, name, value.call(el, i, el.attribs[name]), this.options.xmlMode ); + } }); } return domEach(this, (el) => { From 345ee63570e513c1cc226da0dd4ada9d2e443593 Mon Sep 17 00:00:00 2001 From: David Fei Date: Thu, 17 Aug 2023 16:44:09 -0500 Subject: [PATCH 11/12] Use separate fixture to test attr case logic --- src/__fixtures__/fixtures.ts | 10 ++++++- src/__tests__/deprecated.spec.ts | 2 +- src/api/attributes.spec.ts | 49 ++++++++++++++++++++++++-------- src/api/manipulation.spec.ts | 10 +++---- 4 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/__fixtures__/fixtures.ts b/src/__fixtures__/fixtures.ts index 084d7b4490..cfa261b622 100644 --- a/src/__fixtures__/fixtures.ts +++ b/src/__fixtures__/fixtures.ts @@ -2,7 +2,7 @@ export const fruits = [ '
      ', '
    • Apple
    • ', '
    • Orange
    • ', - '
    • Pear
    • ', + '
    • Pear
    • ', '
    ', ].join(''); @@ -13,6 +13,14 @@ export const vegetables = [ '', ].join(''); +export const meats = [ + '
      ', + '
    • Beef
    • ', + '
    • Chicken
    • ', + '
    • Pork
    • ', + '
    ', +].join(''); + export const divcontainers = [ '
    ', '
    First
    ', diff --git a/src/__tests__/deprecated.spec.ts b/src/__tests__/deprecated.spec.ts index 04ec77200a..9aca7c9fc7 100644 --- a/src/__tests__/deprecated.spec.ts +++ b/src/__tests__/deprecated.spec.ts @@ -172,7 +172,7 @@ describe('deprecated APIs', () => { it('(selector) : should return the outerHTML of the selected element', () => { const $ = cheerio.load(fixtures.fruits); - expect($.html('.pear')).toBe('
  • Pear
  • '); + expect($.html('.pear')).toBe('
  • Pear
  • '); }); }); diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index 5fcf39b20a..150985f3ad 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -8,6 +8,7 @@ import { chocolates, inputs, mixedText, + meats, } from '../__fixtures__/fixtures.js'; function withClass(attr: string) { @@ -42,16 +43,32 @@ describe('$(...)', () => { expect(attr).toBe('autofocus'); }); - it('(valid key) should get uppercase attr with lowercase name', () => { - const $pear = $('.pear'); - expect($pear.attr('FOO')).toBe('true'); - expect($pear.attr('foo')).toBe('true'); + it('(valid key) should get uppercase attr with lowercase name in HTML mode', () => { + const $casetest = load(meats); + const $meats = $casetest('.beef'); + expect($meats.attr('COOKED')).toBe('mediumrare'); + expect($meats.attr('cooked')).toBe('mediumrare'); }); - it('(valid key) should get lowercase attr with uppercase name', () => { - const $pear = $('.pear'); - expect($pear.attr('CLASS')).toBe('pear'); - expect($pear.attr('class')).toBe('pear'); + it('(valid key) should get lowercase attr with uppercase name in HTML mode', () => { + const $casetest = load(meats); + const $meats = $casetest('.beef'); + expect($meats.attr('CLASS')).toBe('beef'); + expect($meats.attr('class')).toBe('beef'); + }); + + it('(valid key) should get uppercase attr with uppercase name only in XML mode', () => { + const $casetest = load(meats, { xmlMode: true }); + const $meats = $casetest('[class="beef"]'); + expect($meats.attr('COOKED')).toBe('mediumrare'); + expect($meats.attr('cooked')).toBeUndefined(); + }); + + it('(valid key) should get lowercase attr with lowercase name only in XML mode', () => { + const $casetest = load(meats, { xmlMode: true }); + const $meats = $casetest('[class="beef"]'); + expect($meats.attr('CLASS')).toBeUndefined(); + expect($meats.attr('class')).toBe('beef'); }); it('(key, value) : should set one attr', () => { @@ -77,10 +94,18 @@ describe('$(...)', () => { expect($src[0]).toBeUndefined(); }); - it('(key, value) should save uppercase attr name as lowercase', () => { - const $pear = $('.pear').attr('BAR', '100'); - expect($pear.attr('BAR')).toBe('100'); - expect($pear.attr('bar')).toBe('100'); + it('(key, value) should save uppercase attr name as lowercase in HTML mode', () => { + const $casetest = load(meats); + const $meats = $casetest('.beef').attr('USDA', 'choice'); + expect($meats.attr('USDA')).toBe('choice'); + expect($meats.attr('usda')).toBe('choice'); + }); + + it('(key, value) should save uppercase attr name as uppercase in XML mode', () => { + const $casetest = load(meats, { xmlMode: true }); + const $meats = $casetest('[class="beef"]').attr('USDA', 'choice'); + expect($meats.attr('USDA')).toBe('choice'); + expect($meats.attr('usda')).toBeUndefined(); }); it('(map) : object map should set multiple attributes', () => { diff --git a/src/api/manipulation.spec.ts b/src/api/manipulation.spec.ts index 2a60d324fb..9d6fcba3f4 100644 --- a/src/api/manipulation.spec.ts +++ b/src/api/manipulation.spec.ts @@ -1729,7 +1729,7 @@ describe('$(...)', () => { [ '
  • Apple
  • ', '
  • Orange
  • ', - '
  • Pear
  • ', + '
  • Pear
  • ', ].join('') ); }); @@ -1777,7 +1777,7 @@ describe('$(...)', () => { it('(elem) : should move the passed element (#940)', () => { $('.apple').html($('.orange')); expect($fruits.html()).toBe( - '
  • Orange
  • Pear
  • ' + '
  • Orange
  • Pear
  • ' ); }); @@ -1809,14 +1809,12 @@ describe('$(...)', () => { describe('.toString', () => { it('() : should get the outerHTML for an element', () => { - expect($fruits.toString()).toBe( - '
    • Apple
    • Orange
    • Pear
    ' - ); + expect($fruits.toString()).toBe(fruits); }); it('() : should return an html string for a set of elements', () => { expect($fruits.find('li').toString()).toBe( - '
  • Apple
  • Orange
  • Pear
  • ' + '
  • Apple
  • Orange
  • Pear
  • ' ); }); From 5b4787e888c7ed54e5af01cd08eca0075d9a4b67 Mon Sep 17 00:00:00 2001 From: David Fei Date: Wed, 23 Aug 2023 14:14:34 -0500 Subject: [PATCH 12/12] Use non-deprecated XML flag in tests --- src/api/attributes.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/attributes.spec.ts b/src/api/attributes.spec.ts index 150985f3ad..fd72074a1e 100644 --- a/src/api/attributes.spec.ts +++ b/src/api/attributes.spec.ts @@ -58,14 +58,14 @@ describe('$(...)', () => { }); it('(valid key) should get uppercase attr with uppercase name only in XML mode', () => { - const $casetest = load(meats, { xmlMode: true }); + const $casetest = load(meats, { xml: true }); const $meats = $casetest('[class="beef"]'); expect($meats.attr('COOKED')).toBe('mediumrare'); expect($meats.attr('cooked')).toBeUndefined(); }); it('(valid key) should get lowercase attr with lowercase name only in XML mode', () => { - const $casetest = load(meats, { xmlMode: true }); + const $casetest = load(meats, { xml: true }); const $meats = $casetest('[class="beef"]'); expect($meats.attr('CLASS')).toBeUndefined(); expect($meats.attr('class')).toBe('beef'); @@ -102,7 +102,7 @@ describe('$(...)', () => { }); it('(key, value) should save uppercase attr name as uppercase in XML mode', () => { - const $casetest = load(meats, { xmlMode: true }); + const $casetest = load(meats, { xml: true }); const $meats = $casetest('[class="beef"]').attr('USDA', 'choice'); expect($meats.attr('USDA')).toBe('choice'); expect($meats.attr('usda')).toBeUndefined();