def test_include_root(self):
        root = get_root()

        set_nav_setting('left', 'display_type', 'tree')
        set_nav_setting('left', 'options', ['tabs', 'stacked', 'include_root'])
        navigation = Navigation(root, self.request)
        result = navigation.navigation_widget_tree()
        assert result['include_root'] == True

        set_nav_setting('left', 'options', ['tabs', 'stacked'])
        result = navigation.navigation_widget_tree()
        assert result['include_root'] == False
    def test_display_type(self):
        root = get_root()

        set_nav_setting('left', 'display_type', 'tree')
        set_nav_setting('left', 'options', ['tabs', 'stacked', 'include_root'])
        navigation = Navigation(root, self.request)
        result = navigation.navigation_widget_tree()

        assert result['display_type'] == 'tree'
        assert result['nav_class'] == 'nav nav-tabs nav-stacked'

        set_nav_setting('left', 'display_type', 'items')
        result = navigation.navigation_widget_tree()
        assert result['display_type'] == 'items'
示例#3
0
    def test_navigation_widget_tree(kn_populate, db_session,
                                    kn_request, events):
        from types import FunctionType
        root = get_root()
        set_nav_setting('left', 'display_type', 'tree')
        set_nav_setting('left', 'options', ['pills'])
        set_nav_setting('left', 'label', u'')
        navigation = Navigation(root, kn_request)
        values = navigation.navigation_widget_tree()

        assert values['display_type'] is 'tree'
        assert values['tree_is_open_all'] is False
        assert values['use_container_class'] is False
        assert values['nav_class'] == 'nav nav-pills'
        assert values['items'] == []
        assert values['label'] == u''
        assert values['location'] is 'left'
        assert type(values['is_node_open']) == FunctionType
        assert values['include_root'] is False
        assert values['show_menu'] is False
        assert values['root'] == root