Skip to content

Commit

Permalink
Add wagtail_hooks tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Loic Teixeira committed Apr 6, 2017
1 parent 153c7f4 commit 75d0b32
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import unittest

from wagtail.wagtailcore.hooks import get_hooks

from wagtaildraftail.wagtail_hooks import draftail_editor_css, draftail_editor_js


Expand All @@ -10,6 +12,14 @@ def test_editor_css(self):
self.assertEqual(
draftail_editor_css(), '<link rel="stylesheet" href="/static/wagtaildraftail/wagtaildraftail.css">')

def test_insert_editor_css_hook(self):
hooks = get_hooks('insert_editor_css')
self.assertIn(draftail_editor_css, hooks, 'Editor CSS should be inserted automatically.')

def test_editor_js(self):
self.assertEqual(
draftail_editor_js(), '<script src="/static/wagtaildraftail/wagtaildraftail.js"></script>')

def test_insert_editor_js(self):
hooks = get_hooks('insert_editor_js')
self.assertIn(draftail_editor_js, hooks, 'Editor JS should be inserted automatically.')

0 comments on commit 75d0b32

Please sign in to comment.