Skip to content

Commit cae11a2

Browse files
committed
test(web): assert the PanelHeader main wrapper exists before locating Close
indexOf returned -1 when the wrapper class was missing, so the search for its closing tag restarted from the template start and the assertion could pass against an unrelated div.
1 parent d2bceb9 commit cae11a2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

apps/pythinker-web/test/agent-detail-panel.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ describe('AgentDetailPanel', () => {
179179
if (path === undefined) throw new Error('PanelHeader.vue was not found');
180180
const source = readFileSync(path, 'utf8');
181181
const template = /<template>([\s\S]*)<\/template>/.exec(source)?.[1] ?? '';
182-
const mainEnd = template.indexOf('</div>', template.indexOf('ui-panel-header__main'));
182+
const mainStart = template.indexOf('class="ui-panel-header__main"');
183+
expect(mainStart).toBeGreaterThan(-1);
184+
const mainEnd = template.indexOf('</div>', mainStart);
183185
const closeStart = template.indexOf('ui-panel-header__close');
184186
expect(mainEnd).toBeGreaterThan(-1);
185187
expect(closeStart).toBeGreaterThan(mainEnd);

0 commit comments

Comments
 (0)