From 75adb55217a0bb0287e8729fc22fd609fc6d8fca Mon Sep 17 00:00:00 2001 From: Thomas Lee Date: Fri, 13 Nov 2015 15:13:10 -0800 Subject: [PATCH] fixed issue #1083 --- .../components/detail-learning-materials.hbs | 8 ++++++-- tests/acceptance/course/learningmaterials-test.js | 13 +++++++++---- .../course/session/learningmaterials-test.js | 13 +++++++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/templates/components/detail-learning-materials.hbs b/app/templates/components/detail-learning-materials.hbs index 7e1123fe8b..f9e1ef4003 100644 --- a/app/templates/components/detail-learning-materials.hbs +++ b/app/templates/components/detail-learning-materials.hbs @@ -95,11 +95,15 @@ {{/if}} - {{#if lmProxy.publicNotes}} + {{#if lmProxy.notes}} {{t 'general.yes'}} + + {{#if lmProxy.publicNotes}} + {{fa-icon 'eye'}} + {{/if}} {{else}} {{t 'general.no'}} - {{/if}} + {{/if}} {{#if lmProxy.sortedDescriptors.length}} diff --git a/tests/acceptance/course/learningmaterials-test.js b/tests/acceptance/course/learningmaterials-test.js index 5b99e769f5..e224543f99 100644 --- a/tests/acceptance/course/learningmaterials-test.js +++ b/tests/acceptance/course/learningmaterials-test.js @@ -128,8 +128,11 @@ test('list learning materials', function(assert) { assert.equal(getElementText(find('td:eq(2)', row)), getText(lm.originalAuthor)); let required = courseLm.required?'Yes':'No'; assert.equal(getElementText(find('td:eq(3)', row)), getText(required)); - let publicNotes = courseLm.publicNotes?'Yes':'No'; - assert.equal(getElementText(find('td:eq(4)', row)), getText(publicNotes)); + let notes = courseLm.notes? 'Yes' : 'No'; + assert.equal(getElementText(find('td:eq(4)', row)), getText(notes)); + let notesBool = courseLm.notes? true : false; + let publicNotes = courseLm.publicNotes ? true : false; + assert.equal(find('td:eq(4) i', row).hasClass('fa-eye'), publicNotes && notesBool); let meshTerms = find('td:eq(5) li', row); if('meshDescriptors' in courseLm){ assert.equal(meshTerms.length, courseLm.meshDescriptors.length); @@ -422,7 +425,8 @@ test('edit learning material', function(assert) { click('.detail-learning-materials button.bigadd'); andThen(function(){ assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(3)')), getText('Yes')); - assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('No')); + assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('Yes'), 'there is content in notes'); + assert.ok(isEmpty(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4) i')), 'publicNotes is false and `eye` icon is not visible'); assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(6)')), getText(fixtures.statuses[2].title)); click('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(0)'); @@ -453,7 +457,8 @@ test('cancel editing learning material', function(assert) { click('.detail-learning-materials button.bigcancel'); andThen(function(){ assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(3)')), getText('No')); - assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('Yes')); + assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('No'), 'no content is available under notes'); + assert.ok(isEmpty(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4) i')), 'publicNotes is true but notes are blank so `eye` icon is not visible'); assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(6)')), getText(fixtures.statuses[0].title)); }); }); diff --git a/tests/acceptance/course/session/learningmaterials-test.js b/tests/acceptance/course/session/learningmaterials-test.js index ba1de8723c..3e8e91f6d5 100644 --- a/tests/acceptance/course/session/learningmaterials-test.js +++ b/tests/acceptance/course/session/learningmaterials-test.js @@ -130,8 +130,11 @@ test('list learning materials', function(assert) { //assert.equal(getElementText(find('td:eq(1)', row)), getText(lm.type));assert.equal(getElementText(find('td:eq(2)', row)), getText(lm.originalAuthor)); let required = sessionLm.required?'Yes':'No'; assert.equal(getElementText(find('td:eq(3)', row)), getText(required)); - let publicNotes = sessionLm.publicNotes?'Yes':'No'; - assert.equal(getElementText(find('td:eq(4)', row)), getText(publicNotes)); + let notes = sessionLm.notes? 'Yes' : 'No'; + assert.equal(getElementText(find('td:eq(4)', row)), getText(notes)); + let notesBool = sessionLm.notes? true : false; + let publicNotes = sessionLm.publicNotes ? true : false; + assert.equal(find('td:eq(4) i', row).hasClass('fa-eye'), publicNotes && notesBool); let meshTerms = find('td:eq(5) li', row); if('meshDescriptors' in sessionLm){ assert.equal(meshTerms.length, sessionLm.meshDescriptors.length); @@ -407,7 +410,8 @@ test('edit learning material', function(assert) { click('.detail-learning-materials button.bigadd'); andThen(function(){ assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(3)')), getText('Yes')); - assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('No')); + assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('Yes'), 'there is content in notes'); + assert.ok(isEmpty(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4) i')), 'publicNotes is false and `eye` icon is not visible'); assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(6)')), getText(fixtures.statuses[2].title)); click('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(0)'); @@ -438,7 +442,8 @@ test('cancel editing learning material', function(assert) { click('.detail-learning-materials button.bigcancel'); andThen(function(){ assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(3)')), getText('No')); - assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('Yes')); + assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4)')), getText('No'), 'no content is available under notes'); + assert.ok(isEmpty(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(4) i')), 'publicNotes is true but notes are blank so `eye` icon is not visible'); assert.equal(getElementText(find('.detail-learning-materials .detail-content tbody tr:eq(0) td:eq(6)')), getText(fixtures.statuses[0].title)); }); });