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.
yungsters committed
Jul 28, 2013 at 01:05 UTC
d5e970b93fc0e5ab9d284c265b170eecee2ad0ad
1 file changed
+3
-3
src/dom/__tests__/Danger-test.js
+3
-3
@@ -59,7 +59,7 @@ describe('Danger', function() {
59
60
it('should render lists of markup with similar `nodeName`', function() {
61
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>']
63
);
64
65
expect(renderedMarkup.length).toBe(3);
@@ -75,13 +75,13 @@ describe('Danger', function() {
75
76
it('should render lists of markup with different `nodeName`', function() {
77
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>']
79
);
80
81
expect(renderedMarkup.length).toBe(3);
82
83
expect(renderedMarkup[0].nodeName).toBe('P');
84
- expect(renderedMarkup[1].nodeName).toBe('TR');
84
+ expect(renderedMarkup[1].nodeName).toBe('TD');
85
expect(renderedMarkup[2].nodeName).toBe('P');
86
87
expect(renderedMarkup[0].innerHTML).toBe('1');