diff --git a/index.html b/index.html index d5a756b..8bdb8a0 100644 --- a/index.html +++ b/index.html @@ -144,7 +144,7 @@
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Jane Doe
Rating: Excellent
@@ -209,24 +214,32 @@Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+
Rating:
++
Jane Doe
Rating: Excellent
-Cathedral Park is a great little park to take the family on a picnic, watch soccer or other games. It has a great playground with swings a mini climbing wall a big sandbox and other kid-friendly activities.
+Arbor Lodge Park is a great little park to take the family on a picnic, watch soccer or other games. It has a great playground with swings a mini climbing wall a big sandbox and other kid-friendly activities.
" + this.name + "
" + + "Rating:" + this.rating + "
" + + "" + this.comment + "
"; } + + + +//User Interface Logic + +$(document).ready(function() { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $("form.form-horizontal").submit(function(event) { + var userName = $("input#reviewName").val(); + var userRating = $("select#reviewRating").val(); + var userComment = $("textarea#reviewComment").val(); + var userReview = new Review (userName, userRating, userComment); + + + newPark.review.push(userReview); + + $("div.realUserReview").text(userReview.fullReview()); + + + + // $("div.realUserReview").append("" + userReview.name + "
"); + // $("div.realUserReview").append("Rating:" + userReview.rating + "
"); + // $("div.realUserReview").append("" + userReview.comment + "
") + + + $("input#reviewName").val(""); + $("select#reviewRating").val(""); + $("textarea#reviewComment").val(""); + + + + + event.preventDefault(); + }); +}); diff --git a/spec/specs.js b/spec/specs.js index 102bf66..a6a4414 100644 --- a/spec/specs.js +++ b/spec/specs.js @@ -3,7 +3,7 @@ describe('Park', function() { var testPark = new Park("Peninsula Park", "north"); expect(testPark.parkName).to.equal("Peninsula Park"); expect(testPark.amenities).to.eql([]); - expect(testPark.reviews).to.eql([]); + expect(testPark.review).to.eql([]); expect(testPark.allParks).to.eql([]); expect(testPark.parkLocation).to.equal("north"); @@ -20,17 +20,20 @@ describe('Park', function() { }); }); -// describe('Location', function() { -// it("creates a location object with the given specifications", function() { -// var testLocation = new Location("NE"); -// testPark.north = true; -// expect(testPark.parkName).to.equal("Peninsula Park"); -// expect(testPark.amenities).to.eql([]); -// expect(testPark.reviews).to.eql([]); -// expect(testPark.allParks).to.eql([]); -// expect(testPark.north).to.equal(true); -// expect(testPark.northEast).to.equal(false); -// expect(testPark.southEast).to.equal(false); -// expect(testPark.northWest).to.equal(false); -// expect(testPark.southWest).to.equal(false); -// }); + + + + +describe('Review', function() { + it("creates a new park review with the given specifications", function() { + var testReview = new Review ("Jane", "Excellent", "Great park for kids and dogs."); + expect(testReview.name).to.equal("Jane"); + expect(testReview.rating).to.equal("Excellent"); + expect(testReview.comment).to.be.a("string"); + }); + + it("creates the fullReview method to combine and style inputs from the user's review", function() { + var testReview = new Review ("Jane", "Excellent", "Great park for kids and dogs."); + expect(testReview.fullReview()).to.equal("Jane
Rating:Excellent
Great park for kids and dogs.
"); + }); +});