Skip to content

Instantly share code, notes, and snippets.

@haingdc
Last active April 10, 2018 03:20
Show Gist options
  • Save haingdc/b3c6357db314da4048cd11fb0b6847c2 to your computer and use it in GitHub Desktop.
Save haingdc/b3c6357db314da4048cd11fb0b6847c2 to your computer and use it in GitHub Desktop.
Thao tác với DOM thông qua TDD
// photo-lister-spec.js
describe("#photoToListItem()", function() {
it("should take a photo object and return a list item string", function() {
var input = {
title: "This is a test",
url: "http://loremflickr.com/960/593",
},
expected =
'<li><figure><img src="http://loremflickr.com/960/593" alt=""/>' +
"<figcaption>This is a test</figcaption></figure></li>";
expect(PhotoLister.photoToListItem(input)).to.equal(expected);
input = { // thêm mới đoạn này
title: "This is another test",
url: "http://loremflickr.com/960/593/puppy",
};
expected =
'<li><figure><img src="http://loremflickr.com/960/593/puppy" alt=""/>' +
"<figcaption>This is another test</figcaption></figure></li>";
expect(PhotoLister.photoToListItem(input)).to.equal(expected);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment