Files
pgadmin4/web/regression/javascript/test-main.js
Ashesh Vashi fd3ddbeafb Implementation of the client side 'url_for(...)' function.
Created a url_for function module to be used by different javascript
modules to use the same functionality of flask at client side.

A python module can expose the list of endpoints, used by its
javascripts, by overriding the 'get_exposed_url_endpoints(self)'
function.

In this patch, we have modified all the browser modules to use this
function. It will allow us to move the majority of the javascript
modules of browser nodes from templates directory to the static
directory.

TODO::
- Move these javascripts modules to the static directory.
- Use this function in all the applicable javascript modules.
  e.g. tools, miscellaneous modules
2017-06-12 12:01:25 +05:30

140 lines
4.1 KiB
JavaScript

//////////////////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2017, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////////////////
var allTestFiles = [];
var TEST_REGEXP = /(spec|test)\.js$/i;
// Get a list of all the test files to include
Object.keys(window.__karma__.files).forEach(function (file) {
if (TEST_REGEXP.test(file)) {
// Normalize paths to RequireJS module names.
// If you require sub-dependencies of test files to be loaded as-is (requiring file extension)
// then do not normalize the paths
var normalizedTestModule = file.replace(/^\/base\/|\.js$/g, '');
allTestFiles.push(normalizedTestModule)
}
});
var sourcesDir = '/base/pgadmin/static/';
require.config({
// Karma serves files under /base, which is the basePath from your config file
baseUrl: '/base',
paths: {
'pgadmin': sourcesDir + 'js/pgadmin',
'alertify': sourcesDir + 'vendor/alertifyjs/alertify',
'jquery': sourcesDir + 'vendor/jquery/jquery-1.11.2',
'jquery.ui': sourcesDir + 'vendor/jquery-ui/jquery-ui-1.11.3',
'jquery.event.drag': sourcesDir + 'vendor/jquery-ui/jquery.event.drag-2.2',
'underscore': sourcesDir + 'vendor/underscore/underscore',
'underscore.string': sourcesDir + 'vendor/underscore/underscore.string',
'slickgrid': sourcesDir + 'vendor/slickgrid/slick.core',
'slickgrid/slick.grid': sourcesDir + 'vendor/slickgrid/slick.grid',
'translations': '/base/regression/javascript/fake_translations',
'pgadmin.browser.endpoints': '/base/regression/javascript/fake_endpoints',
'sources': sourcesDir + 'js',
'browser': '/base/pgadmin/browser/static/js'
},
shim: {
'underscore': {
exports: '_'
},
"slickgrid": {
"deps": [
'jquery', "jquery.ui", "jquery.event.drag"
],
"exports": 'window.Slick'
},
"slickgrid/slick.grid": {
"deps": [
'jquery', "jquery.ui", "jquery.event.drag", "slickgrid"
],
"exports": 'window.Slick.Grid'
},
"sources/slickgrid/pgslick.cellrangedecorator": {
"deps": [
"jquery"
],
"exports": 'PGRowRangeDecorator'
},
"sources/slickgrid/pgslick.cellrangeselector": {
"deps": [
"jquery", "sources/slickgrid/pgslick.cellrangedecorator"
],
"exports": 'PGCellRangeSelector'
},
"sources/selection/xcell_selection_model": {
"deps": [
"jquery", "sources/slickgrid/pgslick.cellrangeselector"
],
"exports": 'XCellSelectionModel'
},
"backbone": {
"deps": ['underscore', 'jquery'],
"exports": 'Backbone'
},
"backbone.paginator": {
"deps": ['underscore', 'jquery', 'backbone']
},
"bootstrap": {
"deps": ['jquery'],
},
"backgrid": {
"deps": ['backform'],
"exports": 'Backgrid',
},
"backgrid.select.all": {
"deps": ['backgrid']
},
"backgrid.paginator": {
"deps": ['backgrid', 'backbone.paginator']
},
"backgrid.filter": {
"deps": ['backgrid']
},
"backgrid.sizeable.columns": {
"deps": ['backgrid']
},
"bootstrap.switch": {
"deps": ['jquery', 'bootstrap'],
"exports": 'jQuery.fn.bootstrapSwitch'
},
"select2": {
"deps": ['jquery'],
"exports": 'jQuery.fn.select2'
},
"bootstrap.datepicker": {
"deps": ['jquery', 'bootstrap'],
"exports": 'jQuery.fn.datepicker'
},
"bootstrap.datetimepicker": {
"deps": ['jquery', 'bootstrap', 'moment'],
"exports": 'jQuery.fn.datetimepicker'
},
"pgadmin.backgrid": {
"deps": ["backgrid", "bootstrap.datetimepicker", "bootstrap.switch"],
},
"pgadmin.backform": {
"deps": ['backform', "pgadmin.backgrid", "select2"],
},
"jquery.event.drag": {
"deps": ['jquery'], "exports": 'jQuery.fn.drag'
},
"jquery.ui": {"deps": ['jquery']}
},
// dynamically load all test files
deps: allTestFiles,
// we have to kickoff jasmine, as it is asynchronous
callback: window.__karma__.start
});