Commit 15 Nodejs Wordbucket : add like, dislike, add new explanation to duplicate word on home page function (ต่อ)
Commits on May 3, 2018
Link GitHub Commit 15 Wordbucket Nodejs
เนื่องจาก ใช้คำเกินที่ blogger.com กำหนดจึงแยกมาจาก link
test/test.js
- เพิ่ม test สำหรับ vote like และ dislike
| @@ -107,17 +107,24 @@ describe('Unit testing', function(){ |
| | }); |
| | }); |
| | |
| | -/* ================== future test ================== |
| | - |
| | //------------VoteTest------------// |
| | it('test_redirects_like_to_word_view', function(){ |
| | - |
| | + server |
| | + .get("word/1/1/like") |
| | + .expect(302) |
| | + .end(function(err, res){ |
| | + res.status.should.equal(302); |
| | + done(); |
| | + }); |
| | }); |
| | it('test_redirects_dislike_to_word_view', function(){ |
| | - |
| | + server |
| | + .get("word/1/1/dislike") |
| | + .expect(302) |
| | + .end(function(err, res){ |
| | + res.status.should.equal(302); |
| | + done(); |
| | + }); |
| | }); |
| | |
| | - |
| | -*/ |
| | - |
| | }); |
views/detail.ejs
- แก้ path ปุ่ม like dislike ใช้ เข้ากับ function likeExplanation() และ dislikeExplanation()
| @@ -19,13 +19,13 @@ |
| | |
| | <h2><%= word %></h2> |
| | |
| | - <table id="id_word_table"> |
| | + <table id="id_explanation_table"> |
| | <% for( var i = 0; i < explanation.length; i++){ %> |
| | <tr><td id="word.word">explanation <%= i+1 + " : " + explanation[i] %><br> |
| | |
| | |
| | - <a href="/word/<%= wordID %>/like">LIKE</a> |
| | - <a href="/word/<%= wordID %>/dislike">DISLIKE</a> |
| | + <%= like[i] %> <a href="/word/<%= wordID %>/<%= explanationID[i] %>/like">LIKE</a> |
| | + <%= dislike[i] %> <a href="/word/<%= wordID %>/<%= explanationID[i] %>/dislike">DISLIKE</a> |
| | </td></tr> |
| | <% } %> |
| | </table>
|
ไม่มีความคิดเห็น:
แสดงความคิดเห็น