Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
13592921
Commit
13592921
authored
May 22, 2015
by
Bernhard Posselt
Browse files
Merge pull request #16536 from rullzer/unit_tests_16511
Unit tests for #16511
parents
ce34edac
914c74ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/js/tests/specs/shareSpec.js
View file @
13592921
...
...
@@ -110,6 +110,86 @@ describe('OC.Share tests', function() {
describe
(
'
Share with link
'
,
function
()
{
// TODO: test ajax calls
// TODO: test password field visibility (whenever enforced or not)
it
(
'
update password on focus out
'
,
function
()
{
$
(
'
#allowShareWithLink
'
).
val
(
'
yes
'
);
OC
.
Share
.
showDropDown
(
'
file
'
,
123
,
$container
,
true
,
31
,
'
shared_file_name.txt
'
);
// Toggle linkshare
$
(
'
#dropdown [name=linkCheckbox]
'
).
click
();
fakeServer
.
requests
[
0
].
respond
(
200
,
{
'
Content-Type
'
:
'
application/json
'
},
JSON
.
stringify
({
data
:
{
token
:
'
xyz
'
},
status
:
'
success
'
})
);
// Enable password, enter password and focusout
$
(
'
#dropdown [name=showPassword]
'
).
click
();
$
(
'
#dropdown #linkPassText
'
).
focus
();
$
(
'
#dropdown #linkPassText
'
).
val
(
'
foo
'
);
$
(
'
#dropdown #linkPassText
'
).
focusout
();
expect
(
fakeServer
.
requests
[
1
].
method
).
toEqual
(
'
POST
'
);
var
body
=
OC
.
parseQueryString
(
fakeServer
.
requests
[
1
].
requestBody
);
expect
(
body
[
'
shareWith
'
]).
toEqual
(
'
foo
'
);
// Set password response
fakeServer
.
requests
[
1
].
respond
(
200
,
{
'
Content-Type
'
:
'
application/json
'
},
JSON
.
stringify
({
data
:
{
token
:
'
xyz
'
},
status
:
'
success
'
})
);
expect
(
$
(
'
#dropdown #linkPassText
'
).
val
()).
toEqual
(
''
);
expect
(
$
(
'
#dropdown #linkPassText
'
).
attr
(
'
placeholder
'
)).
toEqual
(
'
Password protected
'
);
});
it
(
'
update password on enter
'
,
function
()
{
$
(
'
#allowShareWithLink
'
).
val
(
'
yes
'
);
OC
.
Share
.
showDropDown
(
'
file
'
,
123
,
$container
,
true
,
31
,
'
shared_file_name.txt
'
);
// Toggle linkshare
$
(
'
#dropdown [name=linkCheckbox]
'
).
click
();
fakeServer
.
requests
[
0
].
respond
(
200
,
{
'
Content-Type
'
:
'
application/json
'
},
JSON
.
stringify
({
data
:
{
token
:
'
xyz
'
},
status
:
'
success
'
})
);
// Enable password and enter password
$
(
'
#dropdown [name=showPassword]
'
).
click
();
$
(
'
#dropdown #linkPassText
'
).
focus
();
$
(
'
#dropdown #linkPassText
'
).
val
(
'
foo
'
);
$
(
'
#dropdown #linkPassText
'
).
trigger
(
new
$
.
Event
(
'
keyup
'
,
{
keyCode
:
13
}));
expect
(
fakeServer
.
requests
[
1
].
method
).
toEqual
(
'
POST
'
);
var
body
=
OC
.
parseQueryString
(
fakeServer
.
requests
[
1
].
requestBody
);
expect
(
body
[
'
shareWith
'
]).
toEqual
(
'
foo
'
);
// Set password response
fakeServer
.
requests
[
1
].
respond
(
200
,
{
'
Content-Type
'
:
'
application/json
'
},
JSON
.
stringify
({
data
:
{
token
:
'
xyz
'
},
status
:
'
success
'
})
);
expect
(
$
(
'
#dropdown #linkPassText
'
).
val
()).
toEqual
(
''
);
expect
(
$
(
'
#dropdown #linkPassText
'
).
attr
(
'
placeholder
'
)).
toEqual
(
'
Password protected
'
);
});
it
(
'
shows share with link checkbox when allowed
'
,
function
()
{
$
(
'
#allowShareWithLink
'
).
val
(
'
yes
'
);
OC
.
Share
.
showDropDown
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment