Commits

Jan-Jaap Driessen committed 110399f

Fixed bug where mode resources created by string 'shortcut' didn't inherit the renderer, bundling, dependency parameters.

Comments (0)

Files changed (3)

 0.14 (unreleased)
 =================
 
-- Nothing changed yet.
-
+- Fixed bug where mode resources created by string 'shortcut' didn't
+  inherit the renderer, bundling, dependency parameters.
 
 0.13 (2012-08-15)
 =================

fanstatic/core.py

             if argument is None:
                 continue
             elif isinstance(argument, basestring):
-                mode_resource = Resource(library, argument, bottom=bottom)
+                mode_resource = Resource(
+                    library, argument, bottom=bottom, renderer=renderer,
+                    depends=depends, dont_bundle=dont_bundle)
             else:
                 # The dependencies of a mode resource should be the same
                 # or a subset of the dependencies this mode replaces.

fanstatic/test_core.py

     assert needed.resources()[0].relpath == 'k-debug.js'
 
 
+def test_mode_shortcut_inherit_parameters():
+    foo = Library('foo', '')
+    def special_renderer(url):
+        return '<special href="%s"/>' % url
+    a = Resource(foo, 'a.js')
+    k = Resource(
+        foo, 'k.js', debug='k-debug.js',
+        depends=[a],
+        dont_bundle=True,
+        renderer=special_renderer)
+    debug_resource = k.modes['debug']
+    assert debug_resource.depends == k.depends
+    assert debug_resource.renderer == special_renderer
+    assert debug_resource.dont_bundle == True
+
+
 def test_mode_inherit_dependency_nr():
     foo = Library('foo', '')
     k = Resource(foo, 'k.js')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.