@samitouri / QOS-React / commits / 5ba1803ba2

Custom attribute follow up (#10470)

* Wrap ARIA prop warnings in backticks. * Use accurate test names after updating custom attribute logic

Nathan Hunzaker committed Aug 16, 2017 at 10:07 UTC 5ba1803ba2bf8581c2605247f3cf50aebacce1c4
3 files changed +18 -15
src/renderers/dom/shared/__tests__/ReactDOMInvalidARIAHook-test.js
+5 -5
@@ -59,8 +59,8 @@ describe('ReactDOMInvalidARIAHook', () => {
59 mountComponent({'aria-hasPopup': 'true'});
60 expectDev(console.error.calls.count()).toBe(1);
61 expectDev(console.error.calls.argsFor(0)[0]).toContain(
62 - 'Warning: Unknown ARIA attribute aria-hasPopup. ' +
63 - 'Did you mean aria-haspopup?',
62 + 'Warning: Unknown ARIA attribute `aria-hasPopup`. ' +
63 + 'Did you mean `aria-haspopup`?',
64 );
65 });
66
@@ -70,8 +70,8 @@ describe('ReactDOMInvalidARIAHook', () => {
70 mountComponent({ariaHasPopup: 'true'});
71 expectDev(console.error.calls.count()).toBe(1);
72 expectDev(console.error.calls.argsFor(0)[0]).toContain(
73 - 'Warning: Invalid ARIA attribute ariaHasPopup. ' +
74 - 'Did you mean aria-haspopup?',
73 + 'Warning: Invalid ARIA attribute `ariaHasPopup`. ' +
74 + 'Did you mean `aria-haspopup`?',
75 );
76 });
77
@@ -81,7 +81,7 @@ describe('ReactDOMInvalidARIAHook', () => {
81 mountComponent({ariaSomethingInvalid: 'true'});
82 expectDev(console.error.calls.count()).toBe(1);
83 expectDev(console.error.calls.argsFor(0)[0]).toContain(
84 - 'Warning: Invalid ARIA attribute ariaSomethingInvalid. ARIA ' +
84 + 'Warning: Invalid ARIA attribute `ariaSomethingInvalid`. ARIA ' +
85 'attributes follow the pattern aria-* and must be lowercase.',
86 );
87 });
src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
+10 -7
@@ -613,19 +613,22 @@ describe('ReactDOMServerIntegration', () => {
613 expect(e.hasAttribute('className')).toBe(false);
614 });
615
616 - itRenders('no badly cased className with a warning', async render => {
616 + itRenders('badly cased className with a warning', async render => {
617 const e = await render(<div classname="test" />, 1);
618 expect(e.hasAttribute('class')).toBe(false);
619 expect(e.hasAttribute('classname')).toBe(true);
620 });
621
622 - itRenders('className prop when given the alias', async render => {
623 - const e = await render(<div class="test" />, 1);
624 - expect(e.className).toBe('test');
625 - });
622 + itRenders(
623 + 'className prop when given the alias with a warning',
624 + async render => {
625 + const e = await render(<div class="test" />, 1);
626 + expect(e.className).toBe('test');
627 + },
628 + );
629
630 itRenders(
628 - 'no className prop when given a badly cased alias',
631 + 'className prop when given a badly cased alias',
632 async render => {
633 const e = await render(<div cLASs="test" />, 1);
634 expect(e.className).toBe('test');
@@ -1310,7 +1313,7 @@ describe('ReactDOMServerIntegration', () => {
1313 );
1314 });
1315
1313 - itRenders('no svg child element with a badly cased', async render => {
1316 + itRenders('svg child element with a badly cased alias', async render => {
1317 let e = await render(
1318 <svg><image xlinkhref="http://i.imgur.com/w7GCRPb.png" /></svg>,
1319 1,
src/renderers/dom/shared/hooks/ReactDOMInvalidARIAHook.js
+3 -3
@@ -57,7 +57,7 @@ function validateProperty(tagName, name, debugID) {
57 if (correctName == null) {
58 warning(
59 false,
60 - 'Invalid ARIA attribute %s. ARIA attributes follow the pattern aria-* and must be lowercase.%s',
60 + 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s',
61 name,
62 getStackAddendum(debugID),
63 );
@@ -68,7 +68,7 @@ function validateProperty(tagName, name, debugID) {
68 if (name !== correctName) {
69 warning(
70 false,
71 - 'Invalid ARIA attribute %s. Did you mean %s?%s',
71 + 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s',
72 name,
73 correctName,
74 getStackAddendum(debugID),
@@ -94,7 +94,7 @@ function validateProperty(tagName, name, debugID) {
94 if (name !== standardName) {
95 warning(
96 false,
97 - 'Unknown ARIA attribute %s. Did you mean %s?%s',
97 + 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s',
98 name,
99 standardName,
100 getStackAddendum(debugID),