Exemple #1
0
    def test_NeededGroup(self):

        from js.deform import deform_js
        from kotti.fanstatic import contents_view_js
        from kotti.fanstatic import NeededGroup

        def NeededGroupFactory(resources):
            return NeededGroup(resources)

        with raises(ValueError):
            NeededGroupFactory("foo")
        with raises(ValueError):
            NeededGroupFactory(["foo", "bar"])

        needed = NeededGroup([
            deform_js,
        ])

        assert needed.resources == [
            deform_js,
        ]

        needed.add(contents_view_js)

        assert needed.resources == [deform_js, contents_view_js]

        def needed_group_adder(resource):
            needed.add(resource)

        with raises(ValueError):
            needed_group_adder(42)
Exemple #2
0
def test_needed_group():

    from js.deform import deform_js
    from kotti.fanstatic import contents_view_js
    from kotti.fanstatic import NeededGroup

    def NeededGroupFactory(resources):
        return NeededGroup(resources)

    with raises(ValueError):
        NeededGroupFactory("foo")
    with raises(ValueError):
        NeededGroupFactory(["foo", "bar"])

    needed = NeededGroup([deform_js, ])

    assert needed.resources == [deform_js, ]

    needed.add(contents_view_js)

    assert needed.resources == [deform_js, contents_view_js]

    def needed_group_adder(resource):
        needed.add(resource)

    with raises(ValueError):
        needed_group_adder(42)

    needed = NeededGroup()
    assert needed.resources == []
Exemple #3
0
    def test_NeededGroup(self):

        from js.deform_bootstrap import deform_bootstrap_js
        from js.deform import deform_js
        from kotti.fanstatic import kotti_js
        from kotti.fanstatic import NeededGroup

        def NeededGroupFactory(resources):
            return NeededGroup(resources)

        with raises(ValueError):
            NeededGroupFactory("foo")
        with raises(ValueError):
            NeededGroupFactory(["foo", "bar"])

        needed = NeededGroup([deform_js, kotti_js])

        assert needed.resources == [deform_js, kotti_js]

        def needed_group_adder(resource):
            needed.add(resource)

        with raises(ValueError):
            needed_group_adder(42)

        needed.add(deform_bootstrap_js)

        assert needed.resources == [deform_js, kotti_js, deform_bootstrap_js]
Exemple #4
0
from fanstatic import Library
from fanstatic import Resource
from kotti.fanstatic import NeededGroup
from kotti.fanstatic import edit_needed_js
from kotti.fanstatic import view_needed_js

library = Library('kotti_theme_slate', 'static')
css = Resource(library, 'css/bootstrap.css', minified='css/bootstrap.min.css')

edit_needed = NeededGroup([
    css,
    edit_needed_js,
])
view_needed = NeededGroup([
    css,
    view_needed_js,
])


def kotti_configure(settings):
    settings['kotti.fanstatic.view_needed'] = 'kotti_theme_slate.view_needed'
    settings['kotti.fanstatic.edit_needed'] = 'kotti_theme_slate.edit_needed'
Exemple #5
0
 def NeededGroupFactory(resources):
     return NeededGroup(resources)