blob: 049a4d05b768b0c89f9932ca935cabfff4d4cdf0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import unittest
from pykss.section import Section
class SectionTestCase(unittest.TestCase):
def setUp(self):
comment = """
# Form Button
Your standard form button.
:hover - Highlights when hovering.
:disabled - Dims the button when disabled.
.primary - Indicates button is the primary action.
.smaller - A smaller button
Example:
<a href="#" class="button$modifier_class">Button</a><a href="#"[ class="$modifier_class"]?>Button</a>
Styleguide 2.1.1.
"""
self.section = Section(comment.strip(), 'example.css')
def test_parses_the_description(self):
self.assertEqual(self.section.description, '# Form Button\n\nYour standard form button.')
def test_parses_the_modifiers(self):
self.assertEqual(len(self.section.modifiers), 4)
def test_parses_modifier_names(self):
self.assertEqual(self.section.modifiers[0].name, ':hover')
def test_parses_modifier_descriptions(self):
self.assertEqual(self.section.modifiers[0].description, 'Highlights when hovering.')
def test_parses_the_example(self):
expected = '<a href="#" class="button">Button</a><a href="#">Button</a>'
self.assertEqual(self.section.example, expected)
def test_parses_the_styleguide_reference(self):
self.assertEqual(self.section.section, '2.1.1')
def test_handles_when_no_reference(self):
self.section = Section('Styleguide', 'example.css')
self.assertEqual(self.section.section, None)
|