Skip to content

Commit

Permalink
Merge pull request #859 from nistormihai/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
nistormihai committed Sep 10, 2014
2 parents 0ed0504 + ee70960 commit 2c2cf17
Show file tree
Hide file tree
Showing 25 changed files with 138 additions and 63 deletions.
5 changes: 1 addition & 4 deletions plugins/embed/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ before_script:

cache:
- node_modules
- gui-resources/scripts/js/bower_components

after_success:
- grunt coveralls
- gui-resources/scripts/js/bower_components
4 changes: 1 addition & 3 deletions plugins/embed/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ module.exports = function(grunt) {
}
});

grunt.loadNpmTasks('grunt-karma-coveralls');

grunt.registerTask('hint', ['jshint:all', 'jscs:all']);
grunt.registerTask('test', ['karma:once', 'mochaTest:all']);
grunt.registerTask('build', ['hint', 'less:all', 'requirejs']);
grunt.registerTask('ci:travis', ['hint', 'karma:travis', 'mochaTest:all']);
grunt.registerTask('ci:travis', ['hint', 'karma:travis', 'mochaTest:all', 'coveralls']);
grunt.registerTask('ci:bamboo', ['karma:bamboo', 'mochaTest:bamboo']);
grunt.registerTask('default', ['githooks', 'server']);
};
16 changes: 8 additions & 8 deletions plugins/embed/gui-resources/scripts/js/build/main.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions plugins/embed/gui-resources/scripts/js/views/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ define([
// Render `post` if `flag.autoRender: true` or if loading the next page,
// otherwise add it as a pending post.
checkPending: function(post) {
if (this.removePostFromCollection(post)) {
return;
}
// `post.get('updateItem')` returns false for next page loading.
if (!this.flags.autoRender && post.get('updateItem')) {
post.set('pending', true);
Expand Down
8 changes: 5 additions & 3 deletions plugins/embed/gui-themes/themes/aamulehti/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@

define([
'css!theme/liveblog',
'plugins/button-pagination',
'plugins/scroll-pagination',
'plugins/twitter-widgets',
'plugins/post-hash',
'plugins/permanent-link',
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
return {
plugins: [
'button-pagination',
'scroll-pagination',
'twitter-widgets',
'post-hash',
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
8 changes: 5 additions & 3 deletions plugins/embed/gui-themes/themes/ksml-light/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@

define([
'css!theme/liveblog',
'plugins/button-pagination',
'plugins/scroll-pagination',
'plugins/twitter-widgets',
'plugins/post-hash',
'plugins/permanent-link',
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
return {
plugins: [
'button-pagination',
'scroll-pagination',
'twitter-widgets',
'post-hash',
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
8 changes: 5 additions & 3 deletions plugins/embed/gui-themes/themes/ksml/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@

define([
'css!theme/liveblog',
'plugins/button-pagination',
'plugins/scroll-pagination',
'plugins/twitter-widgets',
'plugins/post-hash',
'plugins/permanent-link',
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
return {
plugins: [
'button-pagination',
'scroll-pagination',
'twitter-widgets',
'post-hash',
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
4 changes: 3 additions & 1 deletion plugins/embed/gui-themes/themes/sasa-light/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
Expand All @@ -20,7 +21,8 @@ define([
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
8 changes: 5 additions & 3 deletions plugins/embed/gui-themes/themes/sasa/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@

define([
'css!theme/liveblog',
'plugins/button-pagination',
'plugins/scroll-pagination',
'plugins/twitter-widgets',
'plugins/post-hash',
'plugins/permanent-link',
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
return {
plugins: [
'button-pagination',
'scroll-pagination',
'twitter-widgets',
'post-hash',
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
8 changes: 5 additions & 3 deletions plugins/embed/gui-themes/themes/satakansa/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@

define([
'css!theme/liveblog',
'plugins/button-pagination',
'plugins/scroll-pagination',
'plugins/twitter-widgets',
'plugins/post-hash',
'plugins/permanent-link',
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
return {
plugins: [
'button-pagination',
'scroll-pagination',
'twitter-widgets',
'post-hash',
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
4 changes: 3 additions & 1 deletion plugins/embed/gui-themes/themes/stt-fnb/desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
Expand All @@ -20,7 +21,8 @@ define([
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
4 changes: 3 additions & 1 deletion plugins/embed/gui-themes/themes/stt-fnb/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
Expand All @@ -20,7 +21,8 @@ define([
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
4 changes: 3 additions & 1 deletion plugins/embed/gui-themes/themes/stt-fnb/quirks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ define([
'plugins/social-share',
'plugins/wrappup-toggle',
'plugins/user-comments',
'plugins/status',
'tmpl!theme/container',
'tmpl!theme/item/base'
], function() {
Expand All @@ -20,7 +21,8 @@ define([
'permanent-link',
'social-share',
'wrappup-toggle',
'user-comments'
'user-comments',
'status'
]
};
});
1 change: 1 addition & 0 deletions plugins/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"karma-requirejs": "^0.2.1",
"karma-sinon-chai": "^0.1.5",
"mocha": "^1.18.2",
"mocha-lcov-reporter": "0.0.1",
"phantomjs": "^1.9.7-15",
"protractor": "^0.23.1",
"protractor-screenshot-reporter": "~0.0.4",
Expand Down
57 changes: 43 additions & 14 deletions plugins/embed/spec/embed_spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/*global describe, beforeEach, expect, it, element, by, jasmine */
/*global describe, beforeEach, expect, it, element, by */

var randomText = require('./helpers/utils.js').UUIDv4;
var gotoUri = require('./helpers/liveblog_frontend').gotoUri;
var uploadFixtures = require('./helpers/liveblog_fixtures').uploadFixtures;
var postCreateAndPublish = require('./helpers/liveblog_posts.js').postCreateAndPublish;
var liveblogBackend = require('./helpers/liveblog_posts.js');
var postCreateAndPublish = liveblogBackend.postCreateAndPublish;
var postEdit = liveblogBackend.postEdit;

// Protractor Params:
var pp = protractor.getInstance().params;
Expand Down Expand Up @@ -37,29 +40,55 @@ describe('Embed', function() {
});
});

it(' is updates to show just added post', function() {
it(' is updating to show just added post', function() {
var postContent = randomText();
postCreateAndPublish({
postContent: 'test123'
postContent: postContent
});
console.log(
'[POST] published:' + jasmine.pp(Date())
);
browser.wait(function() {
return browser.isElementPresent(
by.cssContainingText(
'div.liveblog-content p.post-text',
'test123'
postContent
)
);
}, pp.maxTimeout)
.then(function() {
console.log(
'[POST] displayed:' + jasmine.pp(Date())
);
});
}, pp.maxTimeout);
expect(true).toBe(true);
}, pp.maxTimeout);

it(' is updating to show just edited post', function() {
var postContent = randomText(),
newContent = randomText(),
postId;
postCreateAndPublish({
postContent: postContent
}, function(e, r, j, id) {
postId = id;
});
browser.wait(function() {
return browser.isElementPresent(
by.cssContainingText(
'div.liveblog-content p.post-text',
postContent
)
);
}, pp.maxTimeout)
.then(function() {
postEdit({
postId: postId,
newContent: newContent
});
browser.wait(function() {
return browser.isElementPresent(
by.cssContainingText(
'div.liveblog-content p.post-text',
newContent
)
);
}, pp.maxTimeout);
expect(true).toBe(true);
});
}, pp.maxTimeout * 2);
});

});
21 changes: 21 additions & 0 deletions plugins/embed/spec/helpers/liveblog_posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var utils = require('./utils');
var getIdFromHref = utils.getIdFromHref;

exports.postCreate = postCreate;
exports.postEdit = postEdit;
exports.postPublish = postPublish;
exports.postCreateAndPublish = postCreateAndPublish;

Expand All @@ -29,6 +30,26 @@ function postCreate(args, callback) {
});
}

function postEdit(args, callback) {
callback = callback || function() {};
args = args || {};
var newContent = args.newContent || 'Test post',
blogId = args.blogId || protractor.getInstance().params.blogId,
postId = args.postId;
if (!postId) {
throw Error('No postId provided');
}
backendRequestAuth({
method: 'PUT',
uri: '/my/LiveDesk/Blog/' + blogId + '/Post/' + postId,
json: {
'Content': newContent
}
}, function(e, r, j) {
callback(e, r, j);
});
}

function postPublish(args, callback) {
args = args || {};
callback = callback || function() {};
Expand Down

0 comments on commit 2c2cf17

Please sign in to comment.