Skip to content

Commit d5e970b

Browse files
committed
Fix Danger test failures.
The original tests were flawed because the `Danger` module exploits the fact that all React-generated markup has at least one attribute. This allows the module to extract node names from markup strings faster. However, the tests were passing in strings of markup with no attributes. Also, this fixes a test failure due to the test trying to set text content into a `<tr>` which is typically disallowed by browsers (and PhantomJS). This changes it to use `<td>` instead.
1 parent 4cb49f5 commit d5e970b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/dom/__tests__/Danger-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('Danger', function() {
5959

6060
it('should render lists of markup with similar `nodeName`', function() {
6161
var renderedMarkup = Danger.dangerouslyRenderMarkup(
62-
['<p>1</p>', '<p>2</p>', '<p>3</p>']
62+
['<p id="A">1</p>', '<p id="B">2</p>', '<p id="C">3</p>']
6363
);
6464

6565
expect(renderedMarkup.length).toBe(3);
@@ -75,13 +75,13 @@ describe('Danger', function() {
7575

7676
it('should render lists of markup with different `nodeName`', function() {
7777
var renderedMarkup = Danger.dangerouslyRenderMarkup(
78-
['<p>1</p>', '<tr>2</tr>', '<p>3</p>']
78+
['<p id="A">1</p>', '<td id="B">2</td>', '<p id="C">3</p>']
7979
);
8080

8181
expect(renderedMarkup.length).toBe(3);
8282

8383
expect(renderedMarkup[0].nodeName).toBe('P');
84-
expect(renderedMarkup[1].nodeName).toBe('TR');
84+
expect(renderedMarkup[1].nodeName).toBe('TD');
8585
expect(renderedMarkup[2].nodeName).toBe('P');
8686

8787
expect(renderedMarkup[0].innerHTML).toBe('1');

0 commit comments

Comments
 (0)