Commits

Christian Zagrodnick committed 8122890

- Resource.need() did not process the slots argument, despite the argument
being documented.

  • Participants
  • Parent commits e8ea877

Comments (0)

Files changed (3)

 0.13 (unreleased)
 =================
 
-- DummyNeededResources takes the slots argument now.
+- DummyNeededResources did not takes the slots argument.
+
+- Resource.need() did not process the slots argument, despite the argument
+  being documented.
 
 
 0.12 (2012-08-05)

fanstatic/core.py

           contain an entry for it.
         """
         needed = get_needed()
-        needed.need(self)
+        needed.need(self, slots)
 
 # XXX have to lie here: a slot itself is not directly renderable,
 # that's a FilledSlot.

fanstatic/test_slot.py

+from fanstatic import NeededResources, Library, Resource, Slot, SlotError
 import pytest
-from fanstatic import NeededResources, Library, Resource, Slot, SlotError
 
 def test_fill_slot():
     needed = NeededResources()
     assert needed.render() == '''\
 <script type="text/javascript" src="/fanstatic/lib/b-min.js"></script>
 <script type="text/javascript" src="/fanstatic/lib/a.js"></script>'''
+
+
+def test_resource_need_should_pass_slots_to_needed():
+    import fanstatic
+    lib = Library('lib', '')
+    c = Resource(lib, 'c.js')
+    slot = Slot(lib, '.js', depends=[c])
+    a = Resource(lib, 'a.js', depends=[slot])
+    b = Resource(lib, 'b.js', depends=[c])
+    needed = fanstatic.init_needed()
+    try:
+        a.need({slot: c})
+    finally:
+        fanstatic.del_needed()
+    assert slot in needed._slots