Skip to content

Instantly share code, notes, and snippets.

@haingdc
Created April 10, 2018 03:04
Show Gist options
  • Save haingdc/b0dac806c5d9008b887c3dffb679abfa to your computer and use it in GitHub Desktop.
Save haingdc/b0dac806c5d9008b887c3dffb679abfa to your computer and use it in GitHub Desktop.
Thao tác với DOM thông qua TDD
describe("#photoListToHTML()", function() {
it("should take an array of photo objects and convert them to an HTML list", function() {
var input = [
{
title: "This is a test",
url: "http://loremflickr.com/960/593",
},
{
title: "This is another test",
url: "http://loremflickr.com/960/593/puppy",
},
],
expected =
'<ul><li><figure><img src="http://loremflickr.com/960/593" alt=""/>' +
"<figcaption>This is a test</figcaption></figure></li>" +
'<li><figure><img src="http://loremflickr.com/960/593/puppy" alt=""/>' +
"<figcaption>This is another test</figcaption></figure></li></ul>";
expect(PhotoLister.photoListToHTML(input)).to.equal(expected);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment