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.
gristlabs_grist-core/app/client/lib/domUtils.ts

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)}`;
});
};
}