[ml] Register prefix change listener with test root disposable

To make sure it gets disposed after the test is done executing.

GitOrigin-RevId: a7add689a01f6d175632a1cba6200b67dc41256e
This commit is contained in:
Bart van Helvert
2025-07-01 16:22:04 +00:00
committed by intellij-monorepo-bot
parent 18ff9e2d59
commit f341c2404a
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.completion.ml.tracker
import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase
@@ -37,7 +23,7 @@ class PrefixChangeListenerTest: LightFixtureCompletionTestCase() {
fun `test prefix change listener`() {
myFixture.completeBasic()
lookup.setPrefixChangeListener(object : PrefixChangeListener {
lookup.addPrefixChangeListener(object : PrefixChangeListener {
override fun afterAppend(c: Char) {
afterChange.clear()
afterChange.addAll(lookup.items)
@@ -57,7 +43,7 @@ class PrefixChangeListenerTest: LightFixtureCompletionTestCase() {
beforeChange.clear()
beforeChange.addAll(lookup.items)
}
})
}, testRootDisposable)
lastLookupState.clear()
lastLookupState.addAll(lookup.items)