Skip to content

Commit

Permalink
Improve test messages for exercise no. 2. Ref #4
Browse files Browse the repository at this point in the history
  • Loading branch information
voter101 committed Jul 6, 2015
1 parent 809dd43 commit 4cdc2b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions koans/es6/02-PartiesList.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var React = require("react");

// We will work on creating dynamic list of parties nearby.
// Let's see how to render a list of items.
// We will create dynamic list of parties nearby. Let's see how to render
// a list of items.
//
// Task #1: Add another party (or parties) to the list.
// Task #2: Change `ul` HTML attribute `class` to 'parties-list'.

class PartiesList extends React.Component {
// We can nest DOM elements delivered by React just like HTML elements.
// Doesn't this list look familiar to you?
// We can put DOM elements delivered by React just like HTML elements.
// Doesn't this code look familiar to you?
render() {
return (
<ul className="FILL ME">
Expand All @@ -17,7 +17,7 @@ class PartiesList extends React.Component {
);
}
// Think about it: Why is that `className` attribute not called just `class`?
// Hint: JSX isn't HTML.
// Hint: Some words in JavaScript/JSX are reserved...
}

export default PartiesList;
6 changes: 3 additions & 3 deletions test/es6/02-PartiesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ describe("02 - Parties List", () => {
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 exactly one `ul` list");
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 list. :(");
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', "List of parties should have class attributes specified in exercise");
assert.equal(list.props.className, 'parties-list', "`ul` element rendered by React should have `className` attribute `parties-list`");
});
});

Expand Down

0 comments on commit 4cdc2b7

Please sign in to comment.