コード例 #1
0
 def test_govuk_label(self, question):
     assert govuk_label(question) == {
         "classes": "govuk-label--l",
         "isPageHeading": True,
         "for": "input-question",
         "text": "Yes or no?",
     }
コード例 #2
0
    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?"
コード例 #3
0
    def test_optional_question_has_optional_in_label_text(self, question):
        question.optional = True

        assert govuk_label(question)["text"] == "Yes or no? (optional)"
コード例 #4
0
 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?",
     }
コード例 #5
0
 def test_label_text_kwarg(self, question):
     assert govuk_label(question, label_text="This is a label")["text"] == "This is a label"
コード例 #6
0
 def test_label_classes_kwarg(self, question):
     assert "app-label" in govuk_label(question, label_classes=["app-label"])["classes"]
コード例 #7
0
 def test_input_id_kwarg(self, question):
     assert govuk_label(question, input_id="q1")["for"] == "input-q1"