Page MenuHomeWickedGov Phorge

UserCardLoadingView.test.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

UserCardLoadingView.test.js

'use strict';
const { mount } = require( 'vue-test-utils' );
const UserCardLoadingView = require( 'ext.checkUser.userInfoCard/modules/ext.checkUser.userInfoCard/components/UserCardLoadingView.vue' );
QUnit.module( 'ext.checkUser.userInfoCard.UserCardLoadingView', QUnit.newMwEnvironment( {
beforeEach: function () {
this.sandbox.stub( mw, 'msg' ).callsFake( ( key, ...args ) => {
let returnValue = '(' + key;
if ( args.length !== 0 ) {
returnValue += ': ' + args.join( ', ' );
}
return returnValue + ')';
} );
}
} ) );
// Reusable mount helper
function mountComponent() {
return mount( UserCardLoadingView );
}
QUnit.test( 'renders correctly', ( assert ) => {
const wrapper = mountComponent();
assert.true( wrapper.exists(), 'Component renders' );
assert.true(
wrapper.classes().includes( 'ext-checkuser-userinfocard-loading-indicator' ),
'Loading indicator has correct class'
);
} );
QUnit.test( 'uses CdxProgressIndicator component', ( assert ) => {
const wrapper = mountComponent();
const progressIndicator = wrapper.findComponent( { name: 'CdxProgressIndicator' } );
assert.true( progressIndicator.exists(), 'CdxProgressIndicator component exists' );
} );
QUnit.test( 'displays the correct loading label', ( assert ) => {
const wrapper = mountComponent();
const progressIndicator = wrapper.findComponent( { name: 'CdxProgressIndicator' } );
assert.strictEqual(
progressIndicator.text(),
'(checkuser-userinfocard-loading-label)',
'Progress indicator displays the correct loading label'
);
} );
QUnit.test( 'setup function returns the correct loadingLabel', ( assert ) => {
const wrapper = mountComponent();
assert.strictEqual(
wrapper.vm.loadingLabel,
'(checkuser-userinfocard-loading-label)',
'loadingLabel is set correctly from mw.msg'
);
} );

File Metadata

Mime Type
text/plain
Expires
Aug 16 2026, 04:44 (13 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5a/3e/ec51b814262bd706932c7330e04b
Default Alt Text
UserCardLoadingView.test.js (1 KB)

Event Timeline