Last active
September 3, 2022 12:07
-
-
Save dmitry-stepanenko/ae67bac6491507f5a1b0a19859f1b54b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { runValueAccessorTests } from 'ngx-cva-test-suite'; | |
import { CounterControlComponent } from './counter.component'; | |
runValueAccessorTests({ | |
/** Component, that is being tested */ | |
component: CounterControlComponent, | |
/** | |
* All the metadata required for this test to run. | |
* Under the hood calls TestBed.configureTestingModule with provided config. | |
*/ | |
testModuleMetadata: { | |
declarations: [CounterControlComponent], | |
}, | |
/** Whether component is able to track "onBlur" events separately */ | |
supportsOnBlur: false, | |
/** | |
* Tests the correctness of an approach that is used to set value in the component, | |
* when the change is internal. It's optional and can be omitted by passing "null" | |
*/ | |
internalValueChangeSetter: null, | |
/** Function to get the value of a component in a runtime. */ | |
getComponentValue: (fixture) => fixture.componentInstance.value, | |
/** When component is reset by FormControl, it should either get a certain default internal value or "null" */ | |
resetCustomValue: { value: 0 }, | |
/** | |
* This test suite applies up to 3 different values on the component to test different use cases. | |
* Values can be customized using this configuration option. | |
*/ | |
getValues: () => [1, 2, 3], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment