blob: 73830a02199b5280645ec908ffaf84353e0d789b [file] [log] [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as SDK from '../../core/sdk/sdk.js';
import {createTarget} from '../../testing/EnvironmentHelpers.js';
import {describeWithMockConnection} from '../../testing/MockConnection.js';
import * as IssuesManager from '../issues_manager/issues_manager.js';
describeWithMockConnection('CheckFormsIssuesTrigger', () => {
it('should call `checkFormsIssues` on devtools open.', async () => {
const parentTarget = createTarget();
const target = createTarget({parentTarget});
const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
IssuesManager.CheckFormsIssuesTrigger.CheckFormsIssuesTrigger.instance();
const auditsAgent = target.auditsAgent();
assert.exists(resourceTreeModel);
const spyCheckFormsIssues = sinon.stub(auditsAgent, 'invoke_checkFormsIssues');
resourceTreeModel.dispatchEventToListeners(SDK.ResourceTreeModel.Events.Load, {resourceTreeModel, loadTime: 123});
sinon.assert.called(spyCheckFormsIssues);
});
});