summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-10-26 12:49:52 +0100
committerVincent Petry <pvince81@owncloud.com>2015-10-26 15:14:27 +0100
commite1b59ad7f0ad13446ec80c9c43d0eba3ff05d073 (patch)
treead1ee0e1bb4d8e4ee3ae1081007cc34edd02296e /core
parent73750f0c1ec4811de30468f8c2e297e77e7d12f2 (diff)
downloadnextcloud-server-e1b59ad7f0ad13446ec80c9c43d0eba3ff05d073.tar.gz
nextcloud-server-e1b59ad7f0ad13446ec80c9c43d0eba3ff05d073.zip
Fix share link focus on click
Clicking on the link share must focus and select it
Diffstat (limited to 'core')
-rw-r--r--core/js/sharedialoglinkshareview.js5
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js23
2 files changed, 26 insertions, 2 deletions
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index beb8b01c8a8..74afbc9fe02 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -151,8 +151,9 @@
},
onLinkTextClick: function() {
- this.focus();
- this.select();
+ var $el = this.$el.find('.linkText');
+ $el.focus();
+ $el.select();
},
onShowPasswordClick: function() {
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index be926a7cacd..9683c800983 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -235,6 +235,29 @@ describe('OC.Share.ShareDialogView', function() {
expect(dialog.$el.find('.linkCheckbox').prop('checked')).toEqual(true);
expect(dialog.$el.find('.linkText').val()).toEqual(link);
});
+ it('autofocus link text when clicked', function() {
+ $('#allowShareWithLink').val('yes');
+
+ dialog.render();
+
+ // Toggle linkshare
+ dialog.$el.find('.linkCheckbox').click();
+ fakeServer.requests[0].respond(
+ 200,
+ { 'Content-Type': 'application/json' },
+ JSON.stringify({data: {token: 'xyz'}, status: 'success'})
+ );
+
+ var focusStub = sinon.stub($.fn, 'focus');
+ var selectStub = sinon.stub($.fn, 'select');
+ dialog.$el.find('.linkText').click();
+
+ expect(focusStub.calledOnce).toEqual(true);
+ expect(selectStub.calledOnce).toEqual(true);
+
+ focusStub.restore();
+ selectStub.restore();
+ });
describe('password', function() {
var slideToggleStub;