'use babel';

import { CompositeDisposable } from 'atom';

export default {

  subscriptions: null,

  activate() {
    // Events subscribed to in atom's system can be easily cleaned up with a
    // CompositeDisposable
    this.subscriptions = new CompositeDisposable();

    this.subscriptions.add(atom.commands.onDidDispatch(ev => {
      if ('originalEvent' in ev) {
        if (ev['originalEvent'] instanceof KeyboardEvent) {
          // This is already a keyboard event, never mind
          return;
        }
      }

      const command = ev['type']; // For example: "autoflow:reflow-selection"

      const keybindings = atom.keymaps.findKeyBindings({"command": command});
      if (keybindings.length == 0) {
        // No keybindings available, never mind
        return;
      }

      // FIXME: Bring up a notification box
      console.log("Command: " + command + "  Bindings: " + keybindings);
      console.log(ev);
      console.log(keybindings);
    }));
  },

  deactivate() {
    this.subscriptions.dispose();
  },
};

'use babel';

import { CompositeDisposable } from 'atom';

export default {

  subscriptions: null,

  activate() {
    // Events subscribed to in atom's system can be easily cleaned up with a
    // CompositeDisposable
    this.subscriptions = new CompositeDisposable();

    this.subscriptions.add(atom.commands.onDidDispatch(this.handleCommand));
  },

  deactivate() {
    this.subscriptions.dispose();
  },

  handleCommand(event) {
    if ('originalEvent' in event) {
      if (event['originalEvent'] instanceof KeyboardEvent) {
        // This is already a keyboard event, never mind
        return;
      }
    }

    const command = event['type']; // For example: "autoflow:reflow-selection"

    const keybindings = atom.keymaps.findKeyBindings({"command": command});
    if (keybindings.length == 0) {
      // No keybindings available, never mind
      return;
    }

    // FIXME: Bring up a notification box
    console.log("Command: " + command + "  Bindings: " + keybindings);
    console.log(event);
    console.log(keybindings);
  }
};

Move event handling into its own method

Move event handling into its own method


'use strict';

var utils = require('../utils/utilsCtrl.js');

function createColumnsObj(lists) {
  var columns = {};

  for(var list in lists) {
    lists[list].forEach(function(column) {
      columns[column.name] = { duration: 0, cards: 0 };
    });
  }

  return columns;
}

exports.cumulativeFlow = function(cards, lists) {
  var columns = createColumnsObj(lists);
  cards.forEach(function(card) {
    var listName = utils.searchList(card.idList, lists);

    if (listName === 'done') {
      card.time.listTime.forEach(function(step) {
        var listStep = utils.searchList(step.list.id, lists);
        if (listStep !== 'done' && columns[step.list.name]) {
          columns[step.list.name].duration += step.duration;
          columns[step.list.name].cards ++;
        }
      });
    }
  });

  var cumulativeFlow = [];
  for (var column in columns) {
    var current = {};
    var average = columns[column].duration / columns[column].cards;
    var duration = utils.getHumanReadableTime(average);

    if (columns[column]) {
      current = {
        name: column,
        data: [ duration.time ],
        time: duration.format
      };

      cumulativeFlow.push(current);
    }
  }
  return cumulativeFlow;
};

'use strict';

var utils = require('../utils/utilsCtrl.js');

/**
 * Create options to highcharts graphs
 * @param  {json}   lists of trello board
 * @return {json}   json with highcharts format options
 */
function createChartOptions(lists) {
  var bars = {};

  for(var list in lists) {
    lists[list].forEach(function(column) {
      bars[column.name] = {
        duration: 0,
        cards: 0
      };
    });
  }

  return bars;
}

exports.cumulativeFlow = function(cards, lists) {
  var charOptions = createChartOptions(lists);

  cards.forEach(function(card) {
    var listName = utils.searchList(card.idList, lists);

    if (listName === 'done') {
      card.time.listTime.forEach(function(step) {
        var listStep = utils.searchList(step.list.id, lists);
        if (listStep !== 'done' && charOptions[step.list.name]) {
          charOptions[step.list.name].duration += step.duration;
          charOptions[step.list.name].cards ++;
        }
      });
    }
  });

  var cumulativeFlow = [];
  for (var bar in charOptions) {
    var current = {};
    var average = charOptions[bar].duration / charOptions[bar].cards;
    var duration = utils.getHumanReadableTime(average);

    if (charOptions[bar]) {
      current = {
        name: bar,
        data: [ duration.time ],
        time: duration.format
      };

      cumulativeFlow.push(current);
    }
  }
  return cumulativeFlow;
};

Refactor get options git status

Refactor get options git status


var keystone = require('../../../');
	var signin = keystone.get('signin redirect') || 'signin';
	if (signin != 'signin') {
		res.redirect(signin);
	} else {
		keystone.render(req, res, signin, {
			submitted: req.body,
			from: req.query.from,
			logo: keystone.get('signin logo'),
		});
	}
};

var keystone = require('../../../');
var signin = keystone.get('signin redirect') || 'signin';
if (signin !== 'signin') {
	res.redirect(signin);
} else {
	keystone.render(req, res, signin, {
		submitted: req.body,
		from: req.query.from,
		logo: keystone.get('signin logo'),
	});

};

Fix strict quality check and extra }

Fix strict quality check and extra }


/*global angular */
require.config({
  shim: {
    'angular': {
      exports: 'angular'
    }
  },
  paths: {
    app: 'js/app',
    angular: './components/angular/angular'
  },
  baseUrl: '/'
});

(function() {
  console.time('requirejs');
  require([
    // application
    'app',
    'js/mobile-nav.js',
    'js/lib/event_emitter.js',

    // dependencies
    'angular',
//    'shared/js/async_storage.js',

    // 1p libs
//    'js/lib/date_format.js',
    'js/lib/gibberish-aes.js',
    'js/lib/keychain.js',

    // services
//    'js/services/database.js',
    'js/services/dates.js',
    'js/services/http-cache.js',
    'js/services/install.js',

    // controllers
    'js/controllers/login.js',
    'js/controllers/list.js',
    'js/controllers/detail.js',
    'js/controllers/category.js'
  ], function() {
    console.timeEnd('requirejs');

    angular.bootstrap(document, ['app']);
  });

})();

/*global angular */
require.config({
  shim: {
    'angular': {
      exports: 'angular'
    }
  },
  paths: {
    app: 'js/app',
    angular: './components/angular/angular'
  },
  baseUrl: '/'
});

(function() {
  console.time('requirejs');
  require([
    // application
    'app',
    'js/mobile-nav.js',
    'js/lib/event_emitter.js',

    // dependencies
    'angular',
//    'shared/js/async_storage.js',

    // 1p libs
//    'js/lib/date_format.js',
    'js/lib/gibberish-aes.js',
    'js/lib/keychain.js',

    // services
//    'js/services/database.js',
    'js/services/dates.js',
    'js/services/http-cache.js',
    'js/services/install.js',

    // controllers
    'js/controllers/login.js',
    'js/controllers/list.js',
    'js/controllers/category.js',
    'js/controllers/detail.js'
  ], function() {
    console.timeEnd('requirejs');

    angular.bootstrap(document, ['app']);
  });

})();

Fix bad comma in object

Fix bad comma in object


// @flow

/* eslint-disable no-param-reassign */

import get from 'lodash/get'
import set from 'lodash/set'

type RetVal = Object

export function processPayload(data: Object): RetVal {
  return data
}

export function processReceived(data: RetVal, options: { buffers?: Array<string> } = {}) {
  const buffers = options.buffers || []

  if (buffers.length) {
    buffers.forEach(key => {
      const value = get(data, key)
      if (value && value.type === 'Buffer') {
        set(data, key, Buffer.from(value.data))
      }
    })
  }

  return data
}

// @flow

import get from 'lodash/get'
import set from 'lodash/set'

type RetVal = Object

export function processPayload(data: Object): RetVal {
  return data
}

export function processReceived(data: RetVal, options: { buffers?: Array<string> } = {}) {
  const buffers = options.buffers || []

  if (buffers.length) {
    buffers.forEach(key => {
      const value = get(data, key)
      if (value && value.type === 'Buffer') {
        set(data, key, Buffer.from(value.data))
      }
    })
  }

  return data
}

Remove an unnecessary eslint supression

:fire: Remove an unnecessary eslint supression


(function() {
  angular.module('notely.login')
    .factory('AuthInterceptor', AuthInterceptor);

  function AuthInterceptor() {
    return {
      request: function(config) {
        return config;
      }
    }
  }

  angular.module('notely')
    .config(function($httpProvider) {
      return $httpProvider.interceptors.push('AuthInterceptor');
    });
})();

(function() {
  angular.module('notely.login')
    .factory('AuthInterceptor', AuthInterceptor);

  AuthInterceptor['$inject'] = ['AuthToken'];
  function AuthInterceptor(AuthToken) {
    return {
      request: function(config) {
        var token = AuthToken.get();
        if (token) {
          config.headers['Authorization'] = token;
        }
        return config;
      }
    }
  }

  angular.module('notely')
    .config(function($httpProvider) {
      return $httpProvider.interceptors.push('AuthInterceptor');
    });
})();

Add auth header if token is present.

Add auth header if token is present.


/**
 *	fills the righthandside flexTab-Bar with the relevant tools
 *	@see packages/rocketchat-livechat/client/ui.js
 *	@see packages/rocketchat-lib/client/defaultTabBars.js
 */

RocketChat.TabBar.addGroup('starred-messages', ['request', 'expertise']);
RocketChat.TabBar.addGroup('push-notifications', ['request', 'expertise']);

RocketChat.TabBar.addButton({
	groups: ['request', 'expertise', 'live'],
	id: 'external-search',
	i18nTitle: 'Knowledge_Base',
	icon: 'icon-lightbulb',
	template: 'dbsAI_externalSearch',
	order: 0
});

RocketChat.TabBar.addButton({
	groups: ['request', 'expertise'],
	id: 'channel-settings',
	i18nTitle: 'Room_Info',
	icon: 'icon-info-circled',
	template: 'channelSettings',
	order: 1
});

RocketChat.TabBar.addButton({
	groups: ['request', 'expertise'],
	id: 'members-list',
	i18nTitle: 'Members_List',
	icon: 'icon-users',
	template: 'membersList',
	order: 3
});

RocketChat.TabBar.addButton({
	groups: ['request', 'expertise'],
	id: 'message-search',
	i18nTitle: 'Search',
	icon: 'icon-search',
	template: 'messageSearch',
	order: 10
});

RocketChat.TabBar.addButton({
	groups: ['request', 'expertise'],
	id: 'uploaded-files-list',
	i18nTitle: 'Room_uploaded_file_list',
	icon: 'icon-attach',
	template: 'uploadedFilesList',
	order: 30
});

/**
 *	fills the righthandside flexTab-Bar with the relevant tools
 *	@see packages/rocketchat-livechat/client/ui.js
 *	@see packages/rocketchat-lib/client/defaultTabBars.js
 */

RocketChat.TabBar.addGroup('starred-messages', ['request', 'expertise']);
RocketChat.TabBar.addGroup('push-notifications', ['request', 'expertise']);
RocketChat.TabBar.addGroup('channel-settings', ['request', 'expertise']);
RocketChat.TabBar.addGroup('members-list', ['request', 'expertise']);
RocketChat.TabBar.addGroup('message-search',['request', 'expertise']);
RocketChat.TabBar.addGroup('uploaded-files-list',['request', 'expertise']);

RocketChat.TabBar.addButton({
	groups: ['request', 'expertise', 'live'],
	id: 'external-search',
	i18nTitle: 'Knowledge_Base',
	icon: 'icon-lightbulb',
	template: 'dbsAI_externalSearch',
	order: 0
});

Fix tabbar for requests and expertise

Fix tabbar for requests and expertise


'use strict';

var _         = require('lodash');
var commander = require('commander');
var path      = require('path');
var Queue     = require('gear').Queue;
var registry  = require('./tasks');

var build, hasTarget, target,
    targets = ['browser', 'cdn', 'node'];

commander
  .usage('[options] [<languages ...>]')
  .option('-n, --no-compress', 'Disable compression')
  .option('-t, --target <name>', 'Build for target <name> ' +
                                 '[browser, cdn, node]',
                                 'browser')
  .parse(process.argv);

hasTarget = _.contains(targets, commander.target);

target = './' + (hasTarget ? commander.target : 'browser');
build  = require(target);

global.dir       = {};
global.dir.root  = path.dirname(__dirname);
global.dir.build = path.join(dir.root, 'build');

new Queue({ registry: registry })
  .clean(dir.build)
  .log('Starting build.')
  .tasks(build(commander))
  .log('Finished build.')
  .run();

'use strict';

var _         = require('lodash');
var commander = require('commander');
var path      = require('path');
var Queue     = require('gear').Queue;
var registry  = require('./tasks');

var build, hasTarget, target,
    targets = ['browser', 'cdn', 'node'];

commander
  .usage('[options] [<languages ...>]')
  .option('-n, --no-compress', 'Disable compression')
  .option('-t, --target <name>', 'Build for target [browser, cdn, node]',
                                 /^(browser|cdn|node$)/i, 'browser')
  .parse(process.argv);

hasTarget = _.contains(targets, commander.target);

target = './' + (hasTarget ? commander.target : 'browser');
build  = require(target);

global.dir       = {};
global.dir.root  = path.dirname(__dirname);
global.dir.build = path.join(dir.root, 'build');

new Queue({ registry: registry })
  .clean(dir.build)
  .log('Starting build.')
  .tasks(build(commander))
  .log('Finished build.')
  .run();

Use regular expression for target types

Use regular expression for target types


import { ApolloClient } from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { AuthAPI } from '../auth'

const httpLink = createHttpLink({
  uri: process.env.GRAPHQL_URL || 'http://localhost:3001/graphql'
})

const authLink = setContext((_, { headers }) => {
  const token = AuthAPI.getToken()

  if (token) {
    return {
      headers: {
        ...headers,
        authorization: `Bearer ${token}`
      }
    }
  }
  return { headers }
})

const client = new ApolloClient({
  link: authLink.concat(httpLink),
  cache: new InMemoryCache()
})

export default client

import { ApolloClient } from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { setContext } from 'apollo-link-context'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { AuthAPI } from '../auth'

const httpLink = createHttpLink({
  uri: process.env.REACT_APP_GRAPHQL_URL || 'http://localhost:3001/graphql'
})

const authLink = setContext((_, { headers }) => {
  const token = AuthAPI.getToken()

  if (token) {
    return {
      headers: {
        ...headers,
        authorization: `Bearer ${token}`
      }
    }
  }
  return { headers }
})

const client = new ApolloClient({
  link: authLink.concat(httpLink),
  cache: new InMemoryCache()
})

export default client

chore(devops): Change GRAPHQ_URL env variable to default react app config


(function() {
  'use strict';

  angular
    .module('app.auth')
    .controller('AuthController', AuthController);

  AuthController.$inject = ['$location', '$firebaseAuth'];

  function AuthController($location, $firebaseAuth) {
    var vm = this;
    var firebaseReference = new Firebase('https://waitandeat-v2-demo.firebaseio.com/');
    var firebaseAuthObject = $firebaseAuth(firebaseReference);

    vm.user = {
      email: '',
      password: ''
    };

    vm.register = register;
    vm.login = login;
    vm.logout = logout;

    function register(user) {
      return firebaseAuthObject.$createUser(user)
        .then(function() {
          return vm.login(user);
        })
        .catch(function(error) {
          console.log(error);
        });
    }

    function login(user) {
      return firebaseAuthObject.$authWithPassword(user)
        .then(function(loggedInUser) {
          console.log(loggedInUser);
          $location.path('/waitlist');
        })
        .catch(function(error) {
          console.log(error);
        });
    }

    function logout() {
      firebaseAuthObject.$unauth();
      $location.path('/');
    }
  }

})();

(function() {
  'use strict';

  angular
    .module('app.auth')
    .controller('AuthController', AuthController);

  AuthController.$inject = ['$location', '$firebaseAuth', 'FIREBASE_URL'];

  function AuthController($location, $firebaseAuth, FIREBASE_URL) {
    var vm = this;
    var firebaseReference = new Firebase(FIREBASE_URL);
    var firebaseAuthObject = $firebaseAuth(firebaseReference);

    vm.user = {
      email: '',
      password: ''
    };

    vm.register = register;
    vm.login = login;
    vm.logout = logout;

    function register(user) {
      return firebaseAuthObject.$createUser(user)
        .then(function() {
          return vm.login(user);
        })
        .catch(function(error) {
          console.log(error);
        });
    }

    function login(user) {
      return firebaseAuthObject.$authWithPassword(user)
        .then(function(loggedInUser) {
          console.log(loggedInUser);
          $location.path('/waitlist');
        })
        .catch(function(error) {
          console.log(error);
        });
    }

    function logout() {
      firebaseAuthObject.$unauth();
      $location.path('/');
    }
  }

})();

Use FIREBASE_URL in auth module.

Use FIREBASE_URL in auth module.


// Avoid `console` errors in browsers that lack a console.
(function() {
    var method;
    var noop = function () {};
    var methods = [
        'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
        'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
        'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
        'timeStamp', 'trace', 'warn'
    ];
    var length = methods.length;
    var console = (window.console = window.console || {});

    while (length--) {
        method = methods[length];

        // Only stub undefined methods.
        if (!console[method]) {
            console[method] = noop;
        }
    }
}());

// Place any jQuery/helper plugins in here.

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9335012-1']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script');
    ga.type = 'text/javascript';
    ga.async = true;
    ga.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(ga, s);
})();

// Add custom class to our download links

$('#binaries, #pdb-files').find('.external').each(function() {
    $(this).addClass("sourceforge_accelerator_link");
});

Use the SF download links (hack since we can't specify a class with sphinx)


/* global process */
var WebDriver = require("selenium-webdriver");

var driver;
if (process.env.SAUCE_USERNAME !== undefined) {
    var browserArray = process.env.BROWSER.split(':');
    driver = new WebDriver.Builder().usingServer(
        'http://'+ process.env.SAUCE_USERNAME+':'+process.env.SAUCE_ACCESS_KEY+'@ondemand.saucelabs.com:80/wd/hub'
    ).withCapabilities({
        "tunnel-identifier": process.env.TRAVIS_JOB_NUMBER,
        "build": process.env.TRAVIS_JOB_NUMBER,
        "username": process.env.SAUCE_USERNAME,
        "accessKey": process.env.SAUCE_ACCESS_KEY,
    }).forBrowser(browserArray[0], browserArray[1], browserArray[2]).build();
} else {
    driver = new WebDriver.Builder().withCapabilities({ browserName: "chrome" }).build();
}

driver.get('http://localhost:3000/assert/');
var report = driver.wait(WebDriver.until.elementLocated(WebDriver.By.className("report")), 5000);
report.getAttribute("class").then(function (cls) {
    driver.quit();
    if (!cls) {
        throw new Error("cls is null");
    } else if (cls.indexOf("failure") !== -1) {
        throw new Error("cls contains the word failure");
    } else if (cls.indexOf("success") === -1) {
        throw new Error("cls does not contain the word success");
    }
});

/* global process */
var WebDriver = require("selenium-webdriver");

var driver;
if (process.env.SAUCE_USERNAME !== undefined) {
    var browserArray = process.env.BROWSER.split(':');
    driver = new WebDriver.Builder().usingServer(
        'http://'+ process.env.SAUCE_USERNAME+':'+process.env.SAUCE_ACCESS_KEY+'@ondemand.saucelabs.com:80/wd/hub'
    ).withCapabilities({
        "tunnel-identifier": process.env.TRAVIS_JOB_NUMBER,
        "build": process.env.TRAVIS_JOB_NUMBER,
        "username": process.env.SAUCE_USERNAME,
        "accessKey": process.env.SAUCE_ACCESS_KEY,
    }).forBrowser(browserArray[0], browserArray[1], browserArray[2]).build();
} else {
    driver = new WebDriver.Builder().withCapabilities({ browserName: "chrome" }).build();
}

driver.get('http://localhost:3000/assert/');
var report = driver.wait(WebDriver.until.elementLocated(WebDriver.By.className("report")), 5000);
report.getAttribute("class").then(function (cls) {
    report.getText().then(function (text) {
        console.log("\n-----\n" + text + "\n-----");
        driver.quit();
        if (!cls) {
            throw new Error("cls is null");
        } else if (cls.indexOf("failure") !== -1) {
            throw new Error("cls contains the word failure");
        } else if (cls.indexOf("success") === -1) {
            throw new Error("cls does not contain the word success");
        }
    });
});

Make the selenium test log the content of the /assert report to the console


import navigateTo from 'uni-helpers/navigate-to'
import redirectTo from '../../helpers/redirect-to'
import previewImage from '../../helpers/normalize-preview-image'

function addSafeAreaInsets (result) {
  if (result.safeArea) {
    const safeArea = result.safeArea
    result.safeAreaInsets = {
      top: safeArea.top,
      left: safeArea.left,
      right: result.windowWidth - safeArea.right,
      bottom: result.windowHeight - safeArea.bottom
    }
  }
}
export const protocols = {
  redirectTo,
  navigateTo,
  previewImage,
  getSystemInfo: {
    returnValue: addSafeAreaInsets
  },
  getSystemInfoSync: {
    returnValue: addSafeAreaInsets
  }
}
export const todos = [
  'vibrate',
  'preloadPage',
  'unPreloadPage',
  'loadSubPackage'
]
export const canIUses = []

// import navigateTo from 'uni-helpers/navigate-to'
import redirectTo from '../../helpers/redirect-to'
import previewImage from '../../helpers/normalize-preview-image'

function addSafeAreaInsets (result) {
  if (result.safeArea) {
    const safeArea = result.safeArea
    result.safeAreaInsets = {
      top: safeArea.top,
      left: safeArea.left,
      right: result.windowWidth - safeArea.right,
      bottom: result.windowHeight - safeArea.bottom
    }
  }
}
export const protocols = {
  redirectTo,
  // navigateTo,  // 由于在微信开发者工具的页面参数，会显示__id__参数，因此暂时关闭mp-weixin对于navigateTo的AOP
  previewImage,
  getSystemInfo: {
    returnValue: addSafeAreaInsets
  },
  getSystemInfoSync: {
    returnValue: addSafeAreaInsets
  }
}
export const todos = [
  'vibrate',
  'preloadPage',
  'unPreloadPage',
  'loadSubPackage'
]
export const canIUses = []

Remove mp-weixin's AOP of 'navigateTo'

:fire: Remove mp-weixin's AOP of 'navigateTo'


import { createHttpLink } from 'apollo-link-http';

export default createHttpLink({ uri: 'https://api.newspring.cc/graphql' });
// export default createHttpLink({ uri: 'http://localhost:8888/graphql' });

Make it easy to swap out dev code for now


/**
 * WordPress dependencies
 */
import { __, sprintf } from '@wordpress/i18n';

/**
 * External dependencies
 */
import { sanitizeHTML } from 'assets/js/util';

export const settingsDetails = () => {
	const { dashboardPermalink } = global.googlesitekit;

	const content = sprintf(
		/* translators: %s is the URL to the Site Kit dashboard. */
		__( 'To view insights, visit the dashboard.', 'google-site-kit' ),
		dashboardPermalink
	);

	return (

	);
};

/**
 * WordPress dependencies
 */
import { __, sprintf } from '@wordpress/i18n';

/**
 * Internal dependencies
 */
import { sanitizeHTML } from '../../../util';

export const settingsDetails = () => {
	const { dashboardPermalink } = global.googlesitekit;

	const content = sprintf(
		/* translators: %s is the URL to the Site Kit dashboard. */
		__( 'To view insights, visit the dashboard.', 'google-site-kit' ),
		dashboardPermalink
	);

	return (

	);
};

Use relative import for util for now.

Use relative import for util for now.


$(document).ready(function() {
    // There is no default option for disabling a field with django-bootstrap4
    $('#id_mother_tongue').prop('disabled', true);

    // Set tooltips
    $('[data-toggle="tooltip"]').tooltip();
});

$('#id_degree_programme_options').change(function() {
    if (this.value === 'extra') {
        $('#unknown_degree').show();
        $('#unknown_degree input').val('');
    } else {
        $('#unknown_degree').hide();
        $('#unknown_degree input').val(this.value);
    }
});

$('input:radio[name="language"]').change(function() {
    if ($(this).is(':checked')) {
        if ($(this).val() == 'extra') {
            $('#id_mother_tongue').prop('disabled', false);
            $('#id_mother_tongue').val('');
        } else {
            $('#id_mother_tongue').prop('disabled', true);
            $('#id_mother_tongue').val(this.value);
        }
    }
});

$(document).ready(function() {
    // There is no default option for setting readonly a field with django-bootstrap4
    $('#id_mother_tongue').prop('readonly', true);

    // Set tooltips
    $('[data-toggle="tooltip"]').tooltip();
});

$('#id_degree_programme_options').change(function() {
    if (this.value === 'extra') {
        $('#unknown_degree').show();
        $('#unknown_degree input').val('');
    } else {
        $('#unknown_degree').hide();
        $('#unknown_degree input').val(this.value);
    }
});

$('input:radio[name="language"]').change(function() {
    if ($(this).is(':checked')) {
        if ($(this).val() == 'extra') {
            $('#id_mother_tongue').prop('readonly', false);
            $('#id_mother_tongue').val('');
        } else {
            $('#id_mother_tongue').prop('readonly', true);
            $('#id_mother_tongue').val(this.value);
        }
    }
});

Put readonly on mother tongue instead of disabled


// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
	preset: 'ts-jest',
	testEnvironment: 'node',
	collectCoverage: true,
	collectCoverageFrom: [
		'./src/**/*.ts',
	],
	coverageDirectory: 'build',
	globals: {
		'ts-jest': {
			tsconfig: 'test/tsconfig.json',
		},
	},
};

// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
	preset: 'ts-jest',
	testEnvironment: 'node',
	collectCoverage: true,
	collectCoverageFrom: [
		'./src/**/*.ts',
		'!./src/*.ts',
	],
	coverageDirectory: 'build',
	globals: {
		'ts-jest': {
			tsconfig: 'test/tsconfig.json',
		},
	},
};

Exclude entries from unit test report

Exclude entries from unit test report


const got = require('got');

module.exports = data => {
  if (typeof data === 'string') {
    data = { url: data };
  }
  data.method = data.method || 'get';
  data.options = Object.assign({ json: true }, data.options);
  return {
    check: () => got[data.method](data.url, data.options),
    data: { url: data.url },
  };
};

const got = require('got');

module.exports = data => {
  if (typeof data === 'string') {
    data = { url: data };
  }
  data.method = data.method || 'get';
  return {
    check: () => got[data.method](data.url, data.options),
    data: { url: data.url },
  };
};

Remove the JSON parse for the health response