def test_govuk_label(self, question): assert govuk_label(question) == { "classes": "govuk-label--l", "isPageHeading": True, "for": "input-question", "text": "Yes or no?", }
def test_not_optional_question_does_not_have_optional_in_label_text(self, question): question.optional = False assert govuk_label(question)["text"] == "Yes or no?"
def test_optional_question_has_optional_in_label_text(self, question): question.optional = True assert govuk_label(question)["text"] == "Yes or no? (optional)"
def test_is_page_heading_false_removes_classes_and_ispageheading(self, question): assert govuk_label(question, is_page_heading=False) == { "for": "input-question", "text": "Yes or no?", }
def test_label_text_kwarg(self, question): assert govuk_label(question, label_text="This is a label")["text"] == "This is a label"
def test_label_classes_kwarg(self, question): assert "app-label" in govuk_label(question, label_classes=["app-label"])["classes"]
def test_input_id_kwarg(self, question): assert govuk_label(question, input_id="q1")["for"] == "input-q1"