All files / components/tabs/js Tabs.js

85.71% Statements 6/7
50% Branches 1/2
75% Functions 3/4
85.71% Lines 6/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                            3x   3x             3x                                             3x 6x 36x              
/*
Copyright 2011-2016 OCAD University
Copyright 2011 Lucendo Development Ltd.
Copyright 2013 Raising the Floor - US
Copyright 2015 Raising the Floor - International
 
Licensed under the Educational Community License (ECL), Version 2.0 or the New
BSD license. You may not use this file except in compliance with one these
Licenses.
 
You may obtain a copy of the ECL 2.0 License and BSD License at
https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
*/
 
var fluid_3_0_0 = fluid_3_0_0 || {};
 
(function ($, fluid) {
    "use strict";
 
    /**********************
     * Tabs *
     *********************/
 
    fluid.defaults("fluid.tabs", {
        gradeNames: ["fluid.viewComponent"],
        tabOptions: {},
        events: {
            // These events are forwarded out of the jQueryUI Tabs' equivalents
            // with signature (that, event, ui)
            tabsselect: "preventable",
            tabsload: null,
            tabsshow: null
        },
        listeners: {
            "onCreate.initTabs": {
                "this": "{that}.container",
                "method": "tabs",
                "args": "{that}.options.tabOptions"
            },
            "onCreate.bindEvents": {
                priority: "after:initTabs",
                funcName: "fluid.tabs.bindEvents"
            }
        }
    });
 
    fluid.tabs.bindEvents = function (that) { // TODO: The test cases for this component do not exercise any of these events
        fluid.each(that.options.events, function (value, eventName) {
            that.container.on(eventName, function (event, ui) {
                return that.events[eventName].fire(that, event, ui);
            });
        });
    };
 
})(jQuery, fluid_3_0_0);