File size: 1,242 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import PartiesList from '../src/02-PartiesList.js';

describe("02 - Parties List", () => {
  var component;

  beforeEach( () => {
    var elem = document.createElement('div');
    elem = document.body.appendChild(elem);
    return component = React.render(React.createElement(PartiesList), elem);
  });

  afterEach( () => {
    React.unmountComponentAtNode(React.findDOMNode(component));
  });

  describe("should complete all tasks", () => {
    it("Task #1: Party hard - have more than 1 party on party list", () => {
      var lists = React.addons.TestUtils.scryRenderedDOMComponentsWithTag(component, 'ul');
      assert.equal(lists.length, 1, "You must render an `ul` HTML list");

      var list = lists[0];
      var parties = React.addons.TestUtils.scryRenderedDOMComponentsWithTag(list, 'li');

      assert.equal(parties.length > 1, true, "You have only one party on the list. Add one more party to the list.");
    });

    it("Task #2: List has proper class attribute", () => {
      var list = React.addons.TestUtils.findRenderedDOMComponentWithTag(component, 'ul');
      assert.equal(list.props.className, 'parties-list', "`ul` element rendered by React should have `className` attribute `parties-list`");
    });
  });

});