fix: 修复Pio手动换装首次加载默认图
This commit is contained in:
parent
e36fada219
commit
9f95504073
2
public/live2d/wordpress-moc/live2d.min.js
vendored
2
public/live2d/wordpress-moc/live2d.min.js
vendored
@ -8226,7 +8226,7 @@ function LAppModel() {
|
|||||||
this.gl = null;
|
this.gl = null;
|
||||||
this.texPath = "";
|
this.texPath = "";
|
||||||
this.modelPath = "";
|
this.modelPath = "";
|
||||||
this.countOfTexure = -1
|
this.countOfTexure = 0
|
||||||
}
|
}
|
||||||
LAppModel.prototype = new L2DBaseModel();
|
LAppModel.prototype = new L2DBaseModel();
|
||||||
var motionModel;
|
var motionModel;
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
import { flushPromises, mount } from '@vue/test-utils';
|
import { flushPromises, mount } from '@vue/test-utils';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { resolve } from 'node:path';
|
||||||
|
|
||||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
import BlogLive2D from '@/components/blog/BlogLive2D';
|
import BlogLive2D from '@/components/blog/BlogLive2D';
|
||||||
@ -277,6 +280,16 @@ describe('BlogLive2D', () => {
|
|||||||
expect(document.querySelector('.waifu-tips')?.textContent).toContain('只有一套');
|
expect(document.querySelector('.waifu-tips')?.textContent).toContain('只有一套');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('starts manual costume switching from the first variant and loops back to the default texture', () => {
|
||||||
|
const runtimeSource = readFileSync(resolve(process.cwd(), 'public/live2d/wordpress-moc/live2d.min.js'), 'utf-8');
|
||||||
|
|
||||||
|
expect(runtimeSource).toContain('this.countOfTexure = 0');
|
||||||
|
expect(runtimeSource).not.toContain('this.countOfTexure = -1');
|
||||||
|
expect(runtimeSource).toMatch(
|
||||||
|
/if \(no >= thisRef\.modelSetting\.getTextureNum\(\)\) \{\s*motionModel\.countOfTexure = 0;\s*no = 0\s*\}/,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('reuses the page-level WordPress runtime after route component remounts', async () => {
|
it('reuses the page-level WordPress runtime after route component remounts', async () => {
|
||||||
vi.stubGlobal('innerWidth', 1280);
|
vi.stubGlobal('innerWidth', 1280);
|
||||||
const initLive2D = vi.fn();
|
const initLive2D = vi.fn();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user