Skip to content

Commit

Permalink
make sure the icons appear
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Apr 3, 2017
1 parent 5ea8e74 commit 2e7f478
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
Expand Up @@ -2,7 +2,7 @@
<div class="modal-header">
{% block pathway_header %}
<h2>
<i ng-show="icon" class="[[ pathway.icon ]]"></i> {{ pathway.display_name }}
{% if pathway.icon %}{% icon pathway.icon %}{% endif %} {{ pathway.display_name }}
<span ng-show="episode">
([[ episode.demographics[0].first_name ]] [[ episode.demographics[0].surname ]])
</span>
Expand Down
Expand Up @@ -2,7 +2,7 @@
{% load forms %}
{% block pathway_header %}
<h2>
<i ng-show="icon" class="[[ pathway.icon ]]"></i> {{ pathway.display_name }}
{% if pathway.icon %}{% icon pathway.icon %}{% endif %} {{ pathway.display_name }}
<span ng-show="episode">
(<a href="/#/patient/[[ episode.demographics[0].patient_id ]]/[[ episode.demographics[0].id ]]">[[ episode.demographics[0].first_name ]] [[ episode.demographics[0].surname ]]</a>)
</span>
Expand Down
7 changes: 4 additions & 3 deletions pathway/templates/pathway/templates/page_pathway.html
@@ -1,14 +1,15 @@
{% extends "pathway/templates/pathway_base.html" %}
{% load forms %}
{% block pathway_body %}
{% for step in pathway.get_steps %}
<div pathway-step="{{ step.get_api_name }}" class="row">
<div class="col-md-10 col-md-push-1">
<div class="panel panel-default">
<div class="panel-heading">
<h3>
<span ng-show="step.get_icon">
<i class="{{ step.get_icon }}"></i>
</span>
{% if step.get_icon %}
{% icon step.get_icon %}
{% endif %}
{{ step.get_display_name }}
</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion pathway/templates/pathway/templates/pathway_base.html
Expand Up @@ -5,7 +5,7 @@
<div class="panel-heading">
{% block pathway_header %}
<h2>
<i ng-show="icon" class="[[ pathway.icon ]]"></i> {{ pathway.display_name }}
{% if pathway.icon %}{% icon pathway.icon %}{% endif %} {{ pathway.display_name }}
<span ng-show="episode">
(<a href="/#/patient/[[ episode.demographics[0].patient_id ]]/[[ episode.demographics[0].id ]]">[[ episode.demographics[0].first_name ]] [[ episode.demographics[0].surname ]]</a>)
</span>
Expand Down
2 changes: 1 addition & 1 deletion pathway/templates/pathway/templates/wizard_pathway.html
Expand Up @@ -19,7 +19,7 @@
<div class="panel-heading">
<h3>
<span ng-show="step.icon">
<i class="{{ step.icon }}"></i>
{% icon step.get_icon %}
</span>
{{ step.get_display_name }}
</h3>
Expand Down
3 changes: 2 additions & 1 deletion pathway/tests/pathways.py
Expand Up @@ -10,6 +10,7 @@ class PagePathwayExample(pathways.PagePathway):
steps = (
test_models.Demographics,
steps.Step(model=test_models.DogOwner),
test_models.Colour,
)


Expand All @@ -19,5 +20,5 @@ class WizardPathwayExample(pathways.WizardPathway):
icon = "fa fa-something"

steps = (
test_models.FamousLastWords,
test_models.Colour,
)
32 changes: 32 additions & 0 deletions pathway/tests/test_views.py
@@ -1,6 +1,7 @@
from opal.core.test import OpalTestCase
from django.core.urlresolvers import reverse
from pathway.tests import pathways as test_pathways
import mock


class PathwayIndexViewTestCase(OpalTestCase):
Expand Down Expand Up @@ -39,6 +40,9 @@ def test_integration_page_modal(self):
self.assertIn("modal-body", response.content)
self.assertIn('form name="form"', response.content)

# make sure the icon is rendered
self.assertIn('fa fa-something', response.content)

def test_integration_page_non_modal(self):
response = self.get_response(
test_pathways.PagePathwayExample(), is_modal=False
Expand All @@ -47,6 +51,9 @@ def test_integration_page_non_modal(self):
self.assertNotIn("modal-body", response.content)
self.assertIn('form name="form"', response.content)

# make sure the icon is rendered
self.assertIn('fa fa-something', response.content)

def test_integration_wizard_modal(self):
response = self.get_response(
test_pathways.WizardPathwayExample(), is_modal=True
Expand All @@ -55,6 +62,9 @@ def test_integration_wizard_modal(self):
self.assertIn("modal-body", response.content)
self.assertIn('form name="form"', response.content)

# make sure the icon is rendered
self.assertIn('fa fa-something', response.content)

def test_integration_wizard_non_modal(self):
response = self.get_response(
test_pathways.WizardPathwayExample(), is_modal=False
Expand All @@ -64,8 +74,30 @@ def test_integration_wizard_non_modal(self):
self.assertNotIn("modal-body", response.content)
self.assertIn('form name="form"', response.content)

# make sure the icon is rendere
self.assertIn('fa fa-something', response.content)

def test_login_required(self):
response = self.get_response(
test_pathways.WizardPathwayExample(), login=False
)
self.assertEqual(response.status_code, 302)

def test_step_rendered(self):
"""
Make sure Step display name and icon
are rendered in the pathway templates
"""
pathway_types = [
test_pathways.WizardPathwayExample,
test_pathways.PagePathwayExample
]
for pathway in pathway_types:
for is_modal in [True, False]:
response = self.get_response(
pathway(), is_modal=is_modal
)

self.assertEqual(response.status_code, 200)
self.assertIn("Colour", response.content)
self.assertIn('fa fa-something', response.content)

0 comments on commit 2e7f478

Please sign in to comment.