You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
471 B
17 lines
471 B
import {useBindable} from 'app/common/gutil';
|
|
import {BindableValue, dom} from 'grainjs';
|
|
|
|
/**
|
|
* Version of makeTestId that can be appended conditionally.
|
|
*/
|
|
export function makeTestId(prefix: string) {
|
|
return (id: BindableValue<string>, obs?: BindableValue<boolean>) => {
|
|
return dom.cls(use => {
|
|
if (obs !== undefined && !useBindable(use, obs)) {
|
|
return '';
|
|
}
|
|
return `${useBindable(use, prefix)}${useBindable(use, id)}`;
|
|
});
|
|
};
|
|
}
|