Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4140077
Icon.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
Icon.test.js
View Options
const
sinon
=
require
(
'sinon'
),
dom
=
require
(
'../utils/dom'
),
jQuery
=
require
(
'../utils/jQuery'
),
oo
=
require
(
'../utils/oo'
),
mediaWiki
=
require
(
'../utils/mw'
),
mustache
=
require
(
'../utils/mustache'
);
let
Icon
,
sandbox
;
QUnit
.
module
(
'MobileFrontend Icon.js'
,
{
beforeEach
:
function
()
{
sandbox
=
sinon
.
sandbox
.
create
();
dom
.
setUp
(
sandbox
,
global
);
jQuery
.
setUp
(
sandbox
,
global
);
oo
.
setUp
(
sandbox
,
global
);
mediaWiki
.
setUp
(
sandbox
,
global
);
mustache
.
setUp
(
sandbox
,
global
);
Icon
=
require
(
'../../../src/mobile.startup/Icon'
);
},
afterEach
:
function
()
{
jQuery
.
tearDown
();
sandbox
.
restore
();
}
}
);
QUnit
.
test
(
'getIconClasses generates icon classes using icon'
,
function
(
assert
)
{
const
icon
=
new
Icon
(
{
icon
:
'user'
}
);
assert
.
strictEqual
(
icon
.
getIconClasses
(),
'mf-icon mf-icon-user '
);
}
);
QUnit
.
test
(
'getIconClasses generates icon classes using custom icon prefix'
,
function
(
assert
)
{
const
icon
=
new
Icon
(
{
icon
:
'user'
,
glyphPrefix
:
'wikimedia'
}
);
assert
.
strictEqual
(
icon
.
getIconClasses
(),
'mf-icon mf-icon-wikimedia-user '
);
}
);
QUnit
.
test
(
'getRotationClasses returns rotation classes'
,
function
(
assert
)
{
const
iconNeg180
=
new
Icon
(
{
rotation
:
-
180
}
);
const
icon180
=
new
Icon
(
{
rotation
:
180
}
);
const
iconNeg90
=
new
Icon
(
{
rotation
:
-
90
}
);
const
icon90
=
new
Icon
(
{
rotation
:
90
}
);
assert
.
strictEqual
(
iconNeg180
.
getRotationClass
(),
'mf-icon-rotate-flip'
);
assert
.
strictEqual
(
icon180
.
getRotationClass
(),
'mf-icon-rotate-flip'
);
assert
.
strictEqual
(
iconNeg90
.
getRotationClass
(),
'mf-icon-rotate-anti-clockwise'
);
assert
.
strictEqual
(
icon90
.
getRotationClass
(),
'mf-icon-rotate-clockwise'
);
}
);
QUnit
.
test
(
'getGlyphClassName uses icon prefix'
,
function
(
assert
)
{
const
icon
=
new
Icon
(
{
icon
:
'user'
,
glyphPrefix
:
'wikimedia'
}
);
assert
.
strictEqual
(
icon
.
getGlyphClassName
(),
'mf-icon-wikimedia-user'
);
}
);
QUnit
.
test
(
'getGlyphClassName does not use icon prefix if not provided'
,
function
(
assert
)
{
const
icon
=
new
Icon
(
{
icon
:
'user'
,
glyphPrefix
:
''
}
);
assert
.
strictEqual
(
icon
.
getGlyphClassName
(),
'mf-icon-user'
);
}
);
QUnit
.
test
(
'adds small classes'
,
function
(
assert
)
{
const
icon
=
new
Icon
(
{
icon
:
'user'
,
isSmall
:
true
}
);
assert
.
strictEqual
(
icon
.
getClassName
(),
'mf-icon mf-icon-user mf-icon--small '
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 15:20 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8f/f9/99954b6b2def48f66815a0fd0cdc
Default Alt Text
Icon.test.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment