diff --git a/setup.py b/setup.py
index 1877de5..ff18418 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ def package_data(pkg, root_list):
setup(
name='xblock-image-explorer',
- version='1.1.2',
+ version='1.1.3',
description='XBlock - Image Explorer',
packages=['image_explorer'],
install_requires=[
diff --git a/tests/integration/test_image_explorer.py b/tests/integration/test_image_explorer.py
index 2acbf7d..5117a30 100644
--- a/tests/integration/test_image_explorer.py
+++ b/tests/integration/test_image_explorer.py
@@ -47,6 +47,7 @@ def assert_only_hotspotA_revealed(self, block):
self.assertIn("Below are some of the highlights:", block.hotspotA.content.text)
self.assertIn("Once there was a police car up here", block.hotspotA.content.text)
self.assertIn("Also there was a Fire Truck put up there", block.hotspotA.content.text)
+ self.assertIn('visited', block.hotspotA.get_attribute("class"))
def assert_only_hotspotB_revealed(self, block):
hs = self.hotspots(block)
@@ -57,6 +58,7 @@ def assert_only_hotspotB_revealed(self, block):
self.assertIn("Watch the Red Line subway go around the dome", block.hotspotB.content.text)
self.assertTrue(block.hotspotB.find_element_by_css_selector(".image-explorer-hotspot-reveal-youtube"))
+ self.assertIn('visited', block.hotspotB.get_attribute("class"))
def test_simple_scenario(self):
self.set_scenario_xml('')
@@ -65,6 +67,8 @@ def test_simple_scenario(self):
self.assert_in_default_state(block)
+ self.assertNotIn('visited', block.hotspotA.get_attribute("class"))
+ self.assertNotIn('visited', block.hotspotB.get_attribute("class"))
block.hotspotA.click()
self.assert_only_hotspotA_revealed(block)
diff --git a/tests/unit/test_image_explorer.py b/tests/unit/test_image_explorer.py
index b9b55b7..30d2959 100644
--- a/tests/unit/test_image_explorer.py
+++ b/tests/unit/test_image_explorer.py
@@ -1,4 +1,5 @@
import unittest
+from mock import patch
from lxml import etree
from parsel import Selector
@@ -129,3 +130,22 @@ def test_hotspot_coordinates_property(self):
# for schema version 2 hotspot coordinates are centered
self.assertTrue(image_explorer_block_schema2.hotspot_coordinates_centered)
+
+ @patch('image_explorer.image_explorer.ImageExplorerBlock._inner_content')
+ def test__get_hotspots(self, mock__inner_content):
+ """
+ Test _get_hotspots return all hotspots.
+ """
+ image_explorer_data = {'data': self.image_explorer_xml_version2}
+ image_explorer_block_schema2 = ImageExplorerBlock(
+ self.runtime,
+ DictFieldData(image_explorer_data),
+ None
+ )
+ hotspots = image_explorer_block_schema2._get_hotspots(xmltree=etree.fromstring(self.image_explorer_xml))
+ self.assertEqual(len(hotspots), 1)
+ self.assertFalse(hotspots[0].visited)
+ image_explorer_block_schema2.opened_hotspots.append('hotspotA')
+ hotspots = image_explorer_block_schema2._get_hotspots(xmltree=etree.fromstring(self.image_explorer_xml))
+ self.assertEqual(len(hotspots), 1)
+ self.assertTrue(hotspots[0].visited)