Ejemplo n.º 1
0
    def test_parse_complete_block(self):
        value = """
Name

Description Line 1
Description Line 2

.modifier1 - Modifier1
.modifier2 - Modifier2

<div>
  Foobar
</div>

Styleguide 1.2
        """.strip().splitlines()

        block = Block.parse(value)

        self.assertEqual(block.name, "Name")
        self.assertEqual(block.description, "Description Line 1\nDescription Line 2")
        self.assertEqual(len(block.modifiers), 2)
        self.assertEqual(block.modifiers[0].klass, ".modifier1")
        self.assertEqual(block.modifiers[0].description, "Modifier1")
        self.assertEqual(block.modifiers[1].klass, ".modifier2")
        self.assertEqual(block.modifiers[1].description, "Modifier2")
        self.assertEqual(block.example, "<div>\n  Foobar\n</div>")
        self.assertEqual(block.section, "1.2")
        self.assertFalse(block.is_module)
Ejemplo n.º 2
0
    def test_parse_minimal_block(self):
        value = """
Name

Styleguide 1.2
        """.strip().splitlines()

        block = Block.parse(value)

        self.assertEqual(block.name, "Name")
        self.assertEqual(block.description, "")
        self.assertEqual(len(block.modifiers), 0)
        self.assertEqual(block.example, "")
        self.assertEqual(block.section, "1.2")
        self.assertTrue(block.is_module)
Ejemplo n.º 3
0
    def test_parse_block_without_modifiers(self):
        value = """
Name

Description Line 1
Description Line 2

<div>
  Foobar
</div>

Styleguide 1.2
        """.strip().splitlines()

        block = Block.parse(value)

        self.assertEqual(block.name, "Name")
        self.assertEqual(block.description, "Description Line 1\nDescription Line 2")
        self.assertEqual(len(block.modifiers), 0)
        self.assertEqual(block.example, "<div>\n  Foobar\n</div>")
        self.assertEqual(block.section, "1.2")
        self.assertFalse(block.is_module)
Ejemplo n.º 4
0
    def test_parse_block_without_description(self):
        value = """
Name

.modifier1 - Modifier1

<div>
  Foobar
</div>

Styleguide 1.2
        """.strip().splitlines()

        block = Block.parse(value)

        self.assertEqual(block.name, "Name")
        self.assertEqual(block.description, "")
        self.assertEqual(len(block.modifiers), 1)
        self.assertEqual(block.modifiers[0].klass, ".modifier1")
        self.assertEqual(block.modifiers[0].description, "Modifier1")
        self.assertEqual(block.example, "<div>\n  Foobar\n</div>")
        self.assertEqual(block.section, "1.2")
        self.assertFalse(block.is_module)