All files / owid-grapher/grapher/controls/CollapsibleList CollapsibleList.sampleInput.tsx

95.12% Statements 39/41
100% Branches 3/3
66.67% Functions 2/3
95.12% Lines 39/41

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 311x 1x 1x 1x 1x 1x 24x 24x 24x 24x     24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 1x 1x 12x 1x 1x
import React from "react"
import { observer } from "mobx-react"
import { observable, action } from "mobx"
import { range } from "../../../clientUtils/Util"
 
@observer
class SampleCheckBox extends React.Component<{ id: number }> {
    @observable checked: boolean = false
 
    @action.bound onToggle(): void {
        this.checked = !this.checked
    }
 
    render(): JSX.Element {
        return (
            <label className="clickable">
                <input
                    type="checkbox"
                    checked={this.checked}
                    onChange={this.onToggle}
                />
                {` checkbox ${this.props.id}`}
            </label>
        )
    }
}
 
export const collapsibleListSampleItems = range(0, 12).map((i) => (
    <SampleCheckBox key={i} id={i} />
))