aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/tests/specs/sharedialogviewSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/tests/specs/sharedialogviewSpec.js')
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js72
1 files changed, 1 insertions, 71 deletions
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index f0e027d9fb9..6e86cb8eff7 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -41,7 +41,6 @@ describe('OC.Share.ShareDialogView', function() {
beforeEach(function() {
// horrible parameters
$('#testArea').append('<input id="allowShareWithLink" type="hidden" value="yes">');
- $('#testArea').append('<input id="mailPublicNotificationEnabled" name="mailPublicNotificationEnabled" type="hidden" value="yes">');
$container = $('#shareContainer');
/* jshint camelcase:false */
oldAppConfig = _.extend({}, oc_appconfig.core);
@@ -247,7 +246,7 @@ describe('OC.Share.ShareDialogView', function() {
expect(slideToggleStub.callCount).toEqual(1);
expect(slideToggleStub.getCall(0).thisValue.eq(0).attr('id')).toEqual('linkPass');
expect(fakeServer.requests.length).toEqual(0);
-
+
// Now untoggle share by link
dialog.$el.find('.linkCheckbox').click();
dialog.render();
@@ -402,76 +401,7 @@ describe('OC.Share.ShareDialogView', function() {
expect($.datepicker._defaults.maxDate).toEqual(new Date(2014, 0, 27, 0, 0, 0, 0));
});
});
- describe('send link by email', function() {
- var sendEmailPrivateLinkStub;
- var clock;
-
- beforeEach(function() {
- configModel.set({
- isMailPublicNotificationEnabled: true
- });
-
- shareModel.set('linkShare', {
- isLinkShare: true,
- token: 'tehtoken',
- permissions: OC.PERMISSION_READ,
- expiration: null
- });
-
- sendEmailPrivateLinkStub = sinon.stub(dialog.model, "sendEmailPrivateLink");
- clock = sinon.useFakeTimers();
- });
- afterEach(function() {
- sendEmailPrivateLinkStub.restore();
- clock.restore();
- });
- it('displays form when sending emails is enabled', function() {
- $('input[name=mailPublicNotificationEnabled]').val('yes');
- dialog.render();
- expect(dialog.$('.emailPrivateLinkForm').length).toEqual(1);
- });
- it('form not rendered when sending emails is disabled', function() {
- $('input[name=mailPublicNotificationEnabled]').val('no');
- dialog.render();
- expect(dialog.$('.emailPrivateLinkForm').length).toEqual(0);
- });
- it('input cleared on success', function() {
- var defer = $.Deferred();
- sendEmailPrivateLinkStub.returns(defer.promise());
-
- $('input[name=mailPublicNotificationEnabled]').val('yes');
- dialog.render();
-
- dialog.$el.find('.emailPrivateLinkForm .emailField').val('a@b.c');
- dialog.$el.find('#emailButton').trigger('click');
-
- expect(sendEmailPrivateLinkStub.callCount).toEqual(1);
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Sending ...');
-
- defer.resolve();
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Email sent');
-
- clock.tick(2000);
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('');
- });
- it('input not cleared on failure', function() {
- var defer = $.Deferred();
- sendEmailPrivateLinkStub.returns(defer.promise());
-
- $('input[name=mailPublicNotificationEnabled]').val('yes');
- dialog.render();
-
- dialog.$el.find('.emailPrivateLinkForm .emailField').val('a@b.c');
- dialog.$el.find('#emailButton').trigger('click');
-
- expect(sendEmailPrivateLinkStub.callCount).toEqual(1);
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('Sending ...');
-
- defer.reject();
- expect(dialog.$el.find('.emailPrivateLinkForm .emailField').val()).toEqual('a@b.c');
- });
- });
});
describe('check for avatar', function() {
beforeEach(function() {