def test_other_config_visibility(answer_schema_textfield, is_visible, expected_visibility): if is_visible is not None: answer_schema_textfield["visible"] = is_visible other = OtherConfig(Mock(), answer_schema_textfield) assert other.open is expected_visibility
def test_other_config_numeric_input_class(answer_schema_number, max_value, expected_width): if max_value: answer_schema_number["maximum"] = {"value": max_value} other = OtherConfig(Mock(), answer_schema_number) assert other.classes == f"input--w-{expected_width}"
def test_other_config_non_dropdown_has_value_attribute(answer_schema_textfield): other = OtherConfig(MagicMock(), answer_schema_textfield) assert hasattr(other, "value") assert not hasattr(other, "options")
def test_other_config_dropdown_has_options_attribute(answer_schema_dropdown): other = OtherConfig(MagicMock(), answer_schema_dropdown) assert hasattr(other, "options") assert not hasattr(other, "value")
def test_other_config_dropdown_input_type(answer_schema_dropdown): other = OtherConfig(MagicMock(), answer_schema_dropdown) assert other.otherType == "select"
def test_other_config_non_dropdown_input_type(answer_schema_textfield): other = OtherConfig(Mock(), answer_schema_textfield) assert other.otherType == "input"