Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Jan 3, 2020
1 parent 4f8c4b9 commit 925bf17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions colosseum/fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
def get_system_font(keyword):
"""Return a font object from given system font keyword."""
if keyword in SYSTEM_FONT_KEYWORDS:
return '"Arial Black"'
# Get the system font
font = INITIAL_FONT_VALUES.copy()
return font
return None


def construct_font_property(font):
Expand Down
5 changes: 3 additions & 2 deletions colosseum/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,16 @@ def validator(font_value):
raise ValidationError

if no_quotes_val not in font_families:
print(font_families)
raise ValidationError('Font family "{font_value}"'
' not found on system!'.format(font_value=no_quotes_val))

elif val in generic_family:
checked_values.append(val)
else:
# TODO: Check that the font exists?
if _CSS_IDENTIFIER_RE.match(val):
if val not in font_families:
raise ValidationError('Font family "{font_value}"'
' not found on system!'.format(font_value=val))
checked_values.append(val)
else:
raise ValidationError
Expand Down
9 changes: 4 additions & 5 deletions tests/test_declaration.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,14 @@ def test_list_property(self):
self.assertEqual(node.style.font_family, ['initial'])

# Check valid values
node.style.font_family = ['caption']
node.style.font_family = ['serif']
node.style.font_family = ["'Arial Black'", 'serif']

# TODO: This will coerce to a list, is this a valid behavior?
node.style.font_family = 'just-a-string'
self.assertEqual(node.style.font_family, ['just-a-string'])
node.style.font_family = ' just-a-string , caption '
self.assertEqual(node.style.font_family, ['just-a-string', 'caption'])
node.style.font_family = '"Arial Black"'
self.assertEqual(node.style.font_family, ['"Arial Black"'])
node.style.font_family = ' " Arial Black " , serif '
self.assertEqual(node.style.font_family, ['"Arial Black"', 'serif'])

# Check invalid values
with self.assertRaises(ValueError):
Expand Down

0 comments on commit 925bf17

Please sign in to comment.