mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -05:00
Merge pull request #3210 from novaugust/remove-minor-notifications
Remove minor notifications; Close persistent notifications even on error
This commit is contained in:
commit
d7db69831b
6 changed files with 92 additions and 108 deletions
|
@ -77,19 +77,16 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
togglePage: function () {
|
togglePage: function () {
|
||||||
var value = this.toggleProperty('page'),
|
var self = this;
|
||||||
self = this;
|
|
||||||
|
|
||||||
|
this.toggleProperty('page');
|
||||||
// If this is a new post. Don't save the model. Defer the save
|
// If this is a new post. Don't save the model. Defer the save
|
||||||
// to the user pressing the save button
|
// to the user pressing the save button
|
||||||
if (this.get('isNew')) {
|
if (this.get('isNew')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.get('model').save(this.get('saveOptions')).then(function () {
|
this.get('model').save(this.get('saveOptions')).catch(function (errors) {
|
||||||
self.showSuccess('Successfully converted to ' + (value ? 'static page' : 'post'));
|
|
||||||
return value;
|
|
||||||
}).catch(function (errors) {
|
|
||||||
self.showErrors(errors);
|
self.showErrors(errors);
|
||||||
self.get('model').rollback();
|
self.get('model').rollback();
|
||||||
});
|
});
|
||||||
|
@ -205,10 +202,7 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.get('model').save(this.get('saveOptions')).then(function () {
|
this.get('model').save(this.get('saveOptions')).catch(function (errors) {
|
||||||
self.showSuccess('Publish date successfully changed to <strong>' +
|
|
||||||
formatDate(self.get('published_at')) + '</strong>.');
|
|
||||||
}).catch(function (errors) {
|
|
||||||
self.showErrors(errors);
|
self.showErrors(errors);
|
||||||
self.get('model').rollback();
|
self.get('model').rollback();
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,13 +4,11 @@ var PostController = Ember.ObjectController.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
toggleFeatured: function () {
|
toggleFeatured: function () {
|
||||||
var featured = this.toggleProperty('featured'),
|
var options = {disableNProgress: true},
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
this.get('model').save().then(function () {
|
this.toggleProperty('featured');
|
||||||
self.notifications.closePassive();
|
this.get('model').save(options).catch(function (errors) {
|
||||||
self.notifications.showSuccess('Post successfully marked as ' + (featured ? 'featured' : 'not featured') + '.');
|
|
||||||
}).catch(function (errors) {
|
|
||||||
self.notifications.closePassive();
|
self.notifications.closePassive();
|
||||||
self.notifications.showErrors(errors);
|
self.notifications.showErrors(errors);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<label for="url">URL</label>
|
<label for="url">URL</label>
|
||||||
</td>
|
</td>
|
||||||
<td class="post-setting-field">
|
<td class="post-setting-field">
|
||||||
{{gh-blur-input class="post-setting-slug" id="url" value=slugValue action="updateSlug" placeholder=slugPlaceholder selectOnClick="true"}}
|
{{gh-blur-input class="post-setting-slug" id="url" value=slugValue name="post-setting-slug" action="updateSlug" placeholder=slugPlaceholder selectOnClick="true"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="post-setting">
|
<tr class="post-setting">
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<label for="pub-date">Pub Date</label>
|
<label for="pub-date">Pub Date</label>
|
||||||
</td>
|
</td>
|
||||||
<td class="post-setting-field">
|
<td class="post-setting-field">
|
||||||
{{gh-blur-input class="post-setting-date" value=publishedAtValue action="setPublishedAt" placeholder=publishedAtPlaceholder}}
|
{{gh-blur-input class="post-setting-date" value=publishedAtValue name="post-setting-date" action="setPublishedAt" placeholder=publishedAtPlaceholder}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="post-setting">
|
<tr class="post-setting">
|
||||||
|
|
|
@ -68,6 +68,7 @@ var Notifications = Ember.ArrayProxy.extend({
|
||||||
message: message
|
message: message
|
||||||
}, delayed);
|
}, delayed);
|
||||||
},
|
},
|
||||||
|
// @Todo this function isn't referenced anywhere. Should it be removed?
|
||||||
showWarn: function (message, delayed) {
|
showWarn: function (message, delayed) {
|
||||||
this.handleNotification({
|
this.handleNotification({
|
||||||
type: 'warn',
|
type: 'warn',
|
||||||
|
@ -87,7 +88,7 @@ var Notifications = Ember.ArrayProxy.extend({
|
||||||
|
|
||||||
if (notification instanceof Notification) {
|
if (notification instanceof Notification) {
|
||||||
notification.deleteRecord();
|
notification.deleteRecord();
|
||||||
notification.save().then(function () {
|
notification.save().finally(function () {
|
||||||
self.removeObject(notification);
|
self.removeObject(notification);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,7 +9,7 @@ CasperTest.begin('Content screen is correct', 21, function suite(test) {
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ CasperTest.begin('Content list shows correct post status', 7, function testStati
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ CasperTest.begin('Delete post modal', 7, function testDeleteModal(test) {
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -162,18 +162,18 @@ CasperTest.begin('Delete post modal', 7, function testDeleteModal(test) {
|
||||||
// // Placeholder for infinite scrolling/pagination tests (will need to setup 16+ posts).
|
// // Placeholder for infinite scrolling/pagination tests (will need to setup 16+ posts).
|
||||||
//
|
//
|
||||||
// casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
// casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
// test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
// test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
// test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
// test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
// });
|
// });
|
||||||
//});
|
//});
|
||||||
|
|
||||||
CasperTest.begin('Posts can be marked as featured', 10, function suite(test) {
|
CasperTest.begin('Posts can be marked as featured', 8, function suite(test) {
|
||||||
// Create a sample post
|
// Create a sample post
|
||||||
CasperTest.Routines.createTestPost.run(false);
|
CasperTest.Routines.createTestPost.run(false);
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -184,45 +184,39 @@ CasperTest.begin('Posts can be marked as featured', 10, function suite(test) {
|
||||||
test.assert(false, 'The first post can\'t be marked as featured');
|
test.assert(false, 'The first post can\'t be marked as featured');
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function (resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
test.assertSelectorHasText('.notification-message', 'Post successfully marked as featured.');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification :(');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitForSelector('.content-list-content li.featured:first-of-type', function () {
|
casper.waitForSelector('.content-list-content li.featured:first-of-type', function () {
|
||||||
test.assertExists('.content-preview .featured', 'preview pane gets featured class');
|
test.assertExists('.content-preview .featured', 'preview pane gets featured class');
|
||||||
test.assertExists('.content-list-content li.featured:first-of-type', 'content list got a featured star');
|
test.assertExists('.content-list-content li.featured:first-of-type', 'content list got a featured star');
|
||||||
this.click('.notification-success .close');
|
|
||||||
}, function onTimeout() {
|
}, function onTimeout() {
|
||||||
test.assert(false, 'No featured star appeared in the left pane');
|
test.assert(false, 'No featured star appeared in the left pane');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mark as not featured
|
// Mark as not featured
|
||||||
casper.waitWhileSelector('.notification-success', function waitForNoSuccess() {
|
casper.thenClick('.content-preview .featured');
|
||||||
this.click('.content-preview .featured');
|
|
||||||
}, function onTimeout() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function waitForSuccess(resource) {
|
||||||
test.assert(false, 'Success notification wont go away:(');
|
test.assert(400 > resource.status);
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.then(function untoggledFeaturedTest() {
|
||||||
test.assert(true, 'got success notification');
|
test.assertDoesntExist('.content-preview .featured', 'Untoggled featured.');
|
||||||
test.assertSelectorHasText('.notification-message', 'Post successfully marked as not featured.');
|
|
||||||
test.assertDoesntExist('.content-preview .featured');
|
|
||||||
test.assertDoesntExist('.content-list-content li.featured:first-of-type');
|
test.assertDoesntExist('.content-list-content li.featured:first-of-type');
|
||||||
}, function onTimeout() {
|
}, function onTimeout() {
|
||||||
test.assert(false, 'Success notification wont go away:(');
|
test.assert(false, 'Couldn\'t unfeature post.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
CasperTest.begin('Post url can be changed', 7, function suite(test) {
|
CasperTest.begin('Post url can be changed', 5, function suite(test) {
|
||||||
// Create a sample post
|
// Create a sample post
|
||||||
CasperTest.Routines.createTestPost.run(false);
|
CasperTest.Routines.createTestPost.run(false);
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -241,27 +235,26 @@ CasperTest.begin('Post url can be changed', 7, function suite(test) {
|
||||||
this.click('a.post-settings');
|
this.click('a.post-settings');
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function testGoodResponse(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
test.assertSelectorHasText('.notification-message', 'Permalink successfully changed to new-url.');
|
|
||||||
casper.click('.notification-success a.close');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitWhileSelector('.notification-success', function () {
|
casper.then(function checkValueMatches() {
|
||||||
test.assert(true, 'notification cleared.');
|
//using assertField(name) checks the htmls initial "value" attribute, so have to hack around it.
|
||||||
test.assertNotVisible('.notification-success', 'success notification should not still exist');
|
var slugVal = this.evaluate(function () {
|
||||||
|
return __utils__.getFieldValue('post-setting-slug');
|
||||||
|
});
|
||||||
|
test.assertEqual(slugVal, 'new-url');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
CasperTest.begin('Post published date can be changed', 7, function suite(test) {
|
CasperTest.begin('Post published date can be changed', 5, function suite(test) {
|
||||||
// Create a sample post
|
// Create a sample post
|
||||||
CasperTest.Routines.createTestPost.run(false);
|
CasperTest.Routines.createTestPost.run(false);
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -280,17 +273,16 @@ CasperTest.begin('Post published date can be changed', 7, function suite(test) {
|
||||||
this.click('a.post-settings');
|
this.click('a.post-settings');
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function testGoodResponse(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
test.assertSelectorHasText('.notification-message', 'Publish date successfully changed to 22 May 14 @ 23:39.');
|
|
||||||
casper.click('.notification-success a.close');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitWhileSelector('.notification-success', function () {
|
casper.then(function checkValueMatches() {
|
||||||
test.assert(true, 'notification cleared.');
|
//using assertField(name) checks the htmls initial "value" attribute, so have to hack around it.
|
||||||
test.assertNotVisible('.notification-success', 'success notification should not still exist');
|
var dateVal = this.evaluate(function () {
|
||||||
|
return __utils__.getFieldValue('post-setting-date');
|
||||||
|
});
|
||||||
|
test.assertEqual(dateVal, '22 May 14 @ 23:39');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -300,7 +292,7 @@ CasperTest.begin('Post can be changed to static page', 7, function suite(test) {
|
||||||
|
|
||||||
// Begin test
|
// Begin test
|
||||||
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Title is "Ghost Admin"');
|
||||||
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/\d+\/$/, 'Landed on the correct URL');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -312,24 +304,22 @@ CasperTest.begin('Post can be changed to static page', 7, function suite(test) {
|
||||||
|
|
||||||
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function waitForSuccess(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
casper.click('.notification-success a.close');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
|
||||||
});
|
});
|
||||||
|
//Reload the page so the html can update to have the checked attribute
|
||||||
casper.waitWhileSelector('.notification-success', function () {
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
test.assert(true, 'notification cleared.');
|
test.assertExists('.post-setting-static-page[checked=checked]', 'can turn on static page');
|
||||||
test.assertNotVisible('.notification-success', 'success notification should not still exist');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function waitForSuccess(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
casper.click('.notification-success a.close');
|
});
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
//Reload so html can be updated to not have the checked attribute
|
||||||
|
casper.thenOpenAndWaitForPageLoad('content', function testTitleAndUrl() {
|
||||||
|
test.assertDoesntExist('.post-setting-static-page[checked=checked]', 'can turn off static page');
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -243,7 +243,7 @@ casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
CasperTest.begin('Post settings menu', 31, function suite(test) {
|
CasperTest.begin('Post settings menu', 30, function suite(test) {
|
||||||
casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() {
|
casper.thenOpenAndWaitForPageLoad('editor', function testTitleAndUrl() {
|
||||||
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
test.assertTitle('Ghost Admin', 'Ghost admin has no title');
|
||||||
test.assertUrlMatch(/ghost\/editor\/$/, 'Landed on the correct URL');
|
test.assertUrlMatch(/ghost\/editor\/$/, 'Landed on the correct URL');
|
||||||
|
@ -337,45 +337,46 @@ CasperTest.begin('Post settings menu', 31, function suite(test) {
|
||||||
this.click('#publish-bar a.post-settings');
|
this.click('#publish-bar a.post-settings');
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function testGoodResponse(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
test.assertSelectorHasText('.notification-success', 'Publish date successfully changed to 10 May 14 @ 00:17.');
|
|
||||||
casper.thenClick('.notification-success a.close');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitWhileSelector('.notification-success');
|
casper.then(function checkValueMatches() {
|
||||||
|
//using assertField(name) checks the htmls initial "value" attribute, so have to hack around it.
|
||||||
// Test Static Page conversion
|
var dateVal = this.evaluate(function () {
|
||||||
casper.thenClick('#publish-bar a.post-settings');
|
return __utils__.getFieldValue('post-setting-date');
|
||||||
|
});
|
||||||
casper.waitUntilVisible('#publish-bar .post-settings-menu', function onSuccess() {
|
test.assertEqual(dateVal, '10 May 14 @ 00:17');
|
||||||
test.assert(true, 'post settings menu should be visible after clicking post-settings icon');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Test static page toggling
|
||||||
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function testGoodResponse(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
casper.click('.notification-success a.close');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.waitWhileSelector('.notification-success', function () {
|
casper.then(function staticPageIsCheckedTest() {
|
||||||
test.assert(true, 'notification cleared.');
|
var checked = casper.evaluate(function evalCheckedProp() {
|
||||||
test.assertNotVisible('.notification-success', 'success notification should not still exist');
|
return document.querySelector('.post-setting-static-page').checked
|
||||||
|
});
|
||||||
|
test.assert(checked, 'Turned post into static page.');
|
||||||
});
|
});
|
||||||
|
|
||||||
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
casper.thenClick('.post-settings-menu .post-setting-static-page + label');
|
||||||
|
|
||||||
casper.waitForSelector('.notification-success', function waitForSuccess() {
|
casper.waitForResource(/\/posts\/\d+\/\?include=tags/, function testGoodResponse(resource) {
|
||||||
test.assert(true, 'got success notification');
|
test.assert(400 > resource.status);
|
||||||
casper.click('.notification-success a.close');
|
|
||||||
}, function onTimeout() {
|
|
||||||
test.assert(false, 'No success notification');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
casper.then(function staticPageIsCheckedTest() {
|
||||||
|
var checked = casper.evaluate(function evalCheckedProp() {
|
||||||
|
return document.querySelector('.post-setting-static-page').checked
|
||||||
|
});
|
||||||
|
test.assert(!checked, 'Turned page into post.');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Test Delete Post Modal
|
// Test Delete Post Modal
|
||||||
casper.thenClick('.post-settings-menu a.delete');
|
casper.thenClick('.post-settings-menu a.delete');
|
||||||
|
|
Loading…
Add table
Reference in a new issue