Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4135276
mfExtend.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
mfExtend.test.js
View Options
let
mfExtend
;
const
sinon
=
require
(
'sinon'
),
oo
=
require
(
'../utils/oo'
);
/** @type {sinon.SinonSandbox} */
let
sandbox
;
QUnit
.
module
(
'MobileFrontend mfExtend.test.js'
,
{
beforeEach
:
function
()
{
sandbox
=
sinon
.
sandbox
.
create
();
oo
.
setUp
(
sandbox
,
global
);
mfExtend
=
require
(
'../../../src/mobile.startup/mfExtend'
);
},
afterEach
:
function
()
{
sandbox
.
restore
();
}
}
);
QUnit
.
test
(
'mfExtend() - extending from constructor'
,
function
(
assert
)
{
function
TestChild
()
{}
function
TestPrototype
()
{}
mfExtend
(
TestChild
,
TestPrototype
,
{}
);
assert
.
true
(
TestChild
.
prototype
instanceof
TestPrototype
);
}
);
QUnit
.
test
(
'mfExtend() - extending from object'
,
function
(
assert
)
{
const
testPrototype
=
new
TestPrototype
();
function
TestChild
()
{}
function
TestPrototype
()
{
this
.
protoMethod
=
function
()
{
return
true
;
};
}
mfExtend
(
TestChild
,
testPrototype
);
const
testChild
=
new
TestChild
();
assert
.
strictEqual
(
testChild
.
protoMethod
(),
true
);
}
);
QUnit
.
test
(
'mfExtend() - extending from constructor with overrides'
,
function
(
assert
)
{
function
TestChild
()
{}
function
TestPrototype
()
{
this
.
protoMethod
=
function
()
{
return
true
;
};
}
mfExtend
(
TestChild
,
TestPrototype
,
{
protoMethod
:
function
()
{
return
false
;
}
}
);
const
testChild
=
new
TestChild
();
assert
.
strictEqual
(
testChild
.
protoMethod
(),
false
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 13:03 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9e/82/4c1537277878f31c83f957e8cd64
Default Alt Text
mfExtend.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment