Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7452195
mmv.ui.reuse.share.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
mmv.ui.reuse.share.test.js
View Options
/*
* This file is part of the MediaWiki extension MultimediaViewer.
*
* MultimediaViewer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* MultimediaViewer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MultimediaViewer. If not, see <http://www.gnu.org/licenses/>.
*/
const
{
Share
}
=
require
(
'mmv.ui.reuse'
);
function
makeShare
()
{
return
new
Share
(
$
(
'#qunit-fixture'
)
);
}
QUnit
.
module
(
'mmv.ui.reuse.share'
,
QUnit
.
newMwEnvironment
()
);
QUnit
.
test
(
'Sense test, object creation and UI construction'
,
(
assert
)
=>
{
const
share
=
makeShare
();
assert
.
true
(
share
instanceof
Share
,
'Share UI element is created.'
);
assert
.
true
(
share
.
$pageInput
[
0
]
instanceof
HTMLElement
,
'Text field created.'
);
}
);
QUnit
.
test
(
'set()/empty():'
,
(
assert
)
=>
{
const
share
=
makeShare
();
const
image
=
{
// fake ImageModel
title
:
new
mw
.
Title
(
'File:Foobar.jpg'
),
url
:
'https://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg'
,
descriptionUrl
:
'//commons.wikimedia.org/wiki/File:Foobar.jpg'
};
assert
.
notStrictEqual
(
!
share
.
$pageInput
.
val
(),
''
,
'pageInput is empty.'
);
share
.
select
=
function
()
{
assert
.
true
(
true
,
'Text has been selected after data is set.'
);
};
share
.
set
(
image
);
assert
.
notStrictEqual
(
share
.
$pageInput
.
val
(),
''
,
'pageInput is not empty.'
);
share
.
empty
();
assert
.
notStrictEqual
(
!
share
.
$pageInput
.
val
(),
''
,
'pageInput is empty.'
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 22, 22:06 (2 d, 4 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e2/15/45176a265d792c117a963911ea0f
Default Alt Text
mmv.ui.reuse.share.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment