Beispiel #1
0
    def test_colsAttribute(self):
        '''
            test_colsAttribute - Tests the "cols" attribute

                NOTE: This differs in behaviour between a textarea and a frameset
        '''

        textareaEm = AdvancedTag('textarea')

        assert textareaEm.cols == 20, 'Expected default "cols" for textarea to be 20, but got: ' + repr(
            textareaEm.cols)

        textareaEm.cols = 100

        assert textareaEm.cols == 100, 'Expected to be able to set "cols" to 100 and that value stick, but got: ' + repr(
            textareaEm.cols)

        textareaEmHTML = str(textareaEm)

        assert 'cols="100"' in textareaEmHTML, 'Expected to find "cols" attribute set to "100" in HTML, but got: ' + repr(
            textareaEmHTML)

        textareaEm.cols = 0

        assert textareaEm.cols == 20, 'Expected an invalid value in "cols" attribute on textarea to return 20, but got: ' + repr(
            textareaEm.cols)

        framesetEm = AdvancedTag('frameset')

        assert framesetEm.cols == '', 'Expected "cols" attribute on frameset to default to empty string, but got: ' + repr(
            framesetEm.cols)

        framesetEm.cols = "5"

        assert framesetEm.cols == "5", 'Expected to be able to set "cols" attribute to "5" and it apply, but got: ' + repr(
            framesetEm.cols)

        framesetEmHTML = str(framesetEm)

        assert 'cols="5"' in framesetEmHTML, 'Expected "cols" attribute to be set to "5" in HTML representation, but got: ' + repr(
            framesetEmHTML)

        framesetEm.cols = "bologna"

        assert framesetEm.cols == "bologna", 'Expected to be able to set "cols" to any string, set to "bologna" but got back: ' + repr(
            framesetEm.cols)