<commit_before>angular.module('main')
.controller('porjectCtrl', ['$rootScope', '$scope', '$http', '$routeParams', '$mdDialog', '$mdToast',
	function($rootScope, $scope, $http, $routeParams, $mdDialog, $mdToast) {
		$scope.confirm = false;
		$scope.undoToolTip = function(node, removeNode, newSubItem) {
			//debugger;
			var tree = $.extend(true, [], $scope.project.children);
			removeNode(node);
			var toast = $mdToast.simple()
				.content('Node deleted')
				.action('UNDO')
				.highlightAction(false)
				.position($scope.getToastPosition());
			$mdToast.show(toast).then(function() {
				$scope.project.children = $.extend(true, [], tree);
			});
		};
		var project = {'heading': $routeParams.id};
		$http({method:'POST', url:'/project', data: project}).success(function(data) {
			$scope.project = data[0];
			$scope.tree = $scope.project.children;
			$scope.userIndex = -1;
			for (var u in $scope.project.users) {
				if ($scope.project.users[u] === $rootScope.currentUser) {
					$scope.userIndex = u;
				}
			}

			if ($scope.userIndex === -1) {
				$scope.project.users.push($rootScope.currentUser);
				$scope.userIndex = $scope.project.users.length - 1;
			}

			$scope.rootIsEmpty = function() {
				//debugger;
				if (typeof $scope.project.children !== undefined) {
					if ($scope.project.children.length < 1) {
						return true;
					}
				} else {
					return false;
				}
			};
		});
		$scope.saveProject = function() {
			$http({method:'POST', url:'/addChild', data: $scope.project}).success(function() {
				$mdToast.show(
					$mdToast.simple()
					.content('Project saved')
					.position($scope.getToastPosition())
					.hideDelay(3000)
			);
			});

		};

		$scope.addRootNode = function() {
			$scope.project.children.push({id: 'node', title:"Root Node", nodes: [], collapsed : false, estimations : []});
		};
		$scope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
			// Appending dialog to document.body to cover sidenav in docs app
			if (!$scope.confirm) {
				event.preventDefault();
				//console.log(newUrl);
				var confirm = $mdDialog.confirm()
				.parent(angular.element(document.body))
				.title('Are you sure you want to leave this page?')
				.content('All unsaved changes will be lost.')
				.ariaLabel('Yes')
				.ok('Yes')
				.cancel('No')
				.targetEvent(event);
				$mdDialog.show(confirm).then(function() {
				newUrl = newUrl.split('#');
				$scope.goTo(newUrl[1]);
				$scope.confirm = true;
				//$scope.saveProject();
			}, function() {

			});
			}

		});

		$scope.saveProjectDialog = function() {

		};

		$scope.moveLastToTheBeginning = function() {
			var a = $scope.data.pop();
			$scope.data.splice(0, 0, a);
		};

		$scope.newSubItem = function(scope) {
			var nodeData = scope.$modelValue;
			nodeData.nodes.push({
				id: nodeData.id * 10 + nodeData.nodes.length,
				title: nodeData.title + '.' + (nodeData.nodes.length + 1),
				nodes: [],
				collapsed : false,
				estimations : []
			});
		};

		$scope.collapseAll = function() {
			$scope.$broadcast('collapseAll');
		};

		$scope.expandAll = function() {
			$scope.$broadcast('expandAll');
		};

		$scope.getToastPosition = function() {
			return Object.keys($scope.toastPosition)
			.filter(function(pos) { return $scope.toastPosition[pos]; })
			.join(' ');
		};

		$scope.toastPosition = {
			bottom: true,
			top: false,
			left: false,
			right: true
		};

		$scope.estimate = function(node) {
			var currnode = $scope.project.children[0];
			var n;
			$scope.searchTree([currnode], node.$$hashKey, function(res) {
				n = res;
			});
			$scope.estimateForUser(n, node.qty);
		};

		$scope.estimateForUser = function(node, qty) {
			var user = $rootScope.currentUser;
			var count = 0;
			var found = false;
			for (var u in node.users) {
				if (node.users[u] === user) {
					found = true;
					count = u;
					break;
				}
			}
			if (!found) {
				node.users.push(user);
				node.estimations.push(qty);
			} else {
				node.estimations[count] = qty;
			}
		};

		$scope.searchTree = function(node, id, callback) {
			var found = false;
			var result;
			for (var i in node) {
				if (id === node[i].$$hashKey) {
					found = true;
					callback(node[i]);
				}
			}
			if (found === false) {
				for (i in node) {
					$scope.searchTree(node[i].nodes, id, callback);
				}
			}
		};

		$scope.currentNode = undefined;

		$scope.showDescriptionDialog = function(ev, node) {
			$scope.currentNode = node;

			$scope.setCurrentNode(node, function() {
				var newScope = $scope.$new();

				$mdDialog.show({
					controller: DialogController,
					templateUrl: '../../templates/dialogs/project_node_description.tmpl.html',
					parent: angular.element(document.body),
					targetEvent: ev,
					scope: newScope
				});
			});
		};

		$scope.setCurrentNode = function(node, callback) {
			$scope.currentNode = node;

			if (callback !== undefined) {
				callback();
			}
		};
	}]);

function DialogController($scope, $mdDialog) {
  $scope.hide = function() {
    $mdDialog.hide();
  };
  $scope.cancel = function() {
    $mdDialog.cancel();
  };

  $scope.printToConsole = function(input) {
  	console.log(input);
  };
}<commit_msg>Continued work<commit_after>angular.module('main')
.controller('porjectCtrl', ['$rootScope', '$scope', '$http', '$routeParams', '$mdDialog', '$mdToast',
	function($rootScope, $scope, $http, $routeParams, $mdDialog, $mdToast) {
		$scope.confirm = false;
		$scope.undoToolTip = function(node, removeNode, newSubItem) {
			//debugger;
			var tree = $.extend(true, [], $scope.project.children);
			removeNode(node);
			var toast = $mdToast.simple()
				.content('Node deleted')
				.action('UNDO')
				.highlightAction(false)
				.position($scope.getToastPosition());
			$mdToast.show(toast).then(function() {
				$scope.project.children = $.extend(true, [], tree);
			});
		};
		var project = {'heading': $routeParams.id};
		$http({method:'POST', url:'/project', data: project}).success(function(data) {
			$scope.project = data[0];
			$scope.tree = $scope.project.children;
			$scope.userIndex = -1;
			for (var u in $scope.project.users) {
				if ($scope.project.users[u] === $rootScope.currentUser) {
					$scope.userIndex = u;
				}
			}

			if ($scope.userIndex === -1) {
				$scope.project.users.push($rootScope.currentUser);
				$scope.userIndex = $scope.project.users.length - 1;
			}

			$scope.rootIsEmpty = function() {
				//debugger;
				if (typeof $scope.project.children !== undefined) {
					if ($scope.project.children.length < 1) {
						return true;
					}
				} else {
					return false;
				}
			};
		});
		$scope.saveProject = function() {
			$http({method:'POST', url:'/addChild', data: $scope.project}).success(function() {
				$mdToast.show(
					$mdToast.simple()
					.content('Project saved')
					.position($scope.getToastPosition())
					.hideDelay(3000)
			);
			});

		};

		$scope.addRootNode = function() {
			$scope.project.children.push({id: 'node', title:"Root Node", nodes: [], collapsed : false, estimations : []});
		};
		$scope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
			// Appending dialog to document.body to cover sidenav in docs app
			if (!$scope.confirm) {
				event.preventDefault();
				//console.log(newUrl);
				var confirm = $mdDialog.confirm()
				.parent(angular.element(document.body))
				.title('Are you sure you want to leave this page?')
				.content('All unsaved changes will be lost.')
				.ariaLabel('Yes')
				.ok('Yes')
				.cancel('No')
				.targetEvent(event);
				$mdDialog.show(confirm).then(function() {
				newUrl = newUrl.split('#');
				$scope.goTo(newUrl[1]);
				$scope.confirm = true;
				//$scope.saveProject();
			}, function() {

			});
			}

		});

		$scope.saveProjectDialog = function() {

		};

		$scope.moveLastToTheBeginning = function() {
			var a = $scope.data.pop();
			$scope.data.splice(0, 0, a);
		};

		$scope.newSubItem = function(scope) {
			var nodeData = scope.$modelValue;
			nodeData.nodes.push({
				id: nodeData.id * 10 + nodeData.nodes.length,
				title: nodeData.title + '.' + (nodeData.nodes.length + 1),
				nodes: [],
				collapsed : false,
				estimations : []
			});
		};

		$scope.collapseAll = function() {
			$scope.$broadcast('collapseAll');
		};

		$scope.expandAll = function() {
			$scope.$broadcast('expandAll');
		};

		$scope.getToastPosition = function() {
			return Object.keys($scope.toastPosition)
			.filter(function(pos) { return $scope.toastPosition[pos]; })
			.join(' ');
		};

		$scope.toastPosition = {
			bottom: true,
			top: false,
			left: false,
			right: true
		};

		$scope.estimate = function(node) {
			var currnode = $scope.project.children[0];
			var n;
			$scope.searchTree([currnode], node.$$hashKey, function(res) {
				n = res;
			});
			$scope.estimateForUser(n, node.qty);
		};

		$scope.estimateForUser = function(node, qty) {
			var user = $rootScope.currentUser;
			var count = 0;
			var found = false;
			for (var u in node.users) {
				if (node.users[u] === user) {
					found = true;
					count = u;
					break;
				}
			}
			if (!found) {
				node.users.push(user);
				node.estimations.push(qty);
			} else {
				node.estimations[count] = qty;
			}
		};

		$scope.searchTree = function(node, id, callback) {
			var found = false;
			var result;
			for (var i in node) {
				if (id === node[i].$$hashKey) {
					found = true;
					callback(node[i]);
				}
			}
			if (found === false) {
				for (i in node) {
					$scope.searchTree(node[i].nodes, id, callback);
				}
			}
		};

		$scope.currentNode = undefined;

		$scope.showDescriptionDialog = function(ev, node) {
			$scope.currentNode = node;

			$scope.setCurrentNode(node, function() {
				var newScope = $scope.$new();

				$mdDialog.show({
					controller: DialogController,
					templateUrl: '../../templates/dialogs/project_node_description.tmpl.html',
					parent: angular.element(document.body),
					targetEvent: ev,
					scope: newScope
				});
			});
		};

		$scope.setCurrentNode = function(node, callback) {
			$scope.currentNode = node;

			if (callback !== undefined) {
				callback();
			}
		};
	}]);

function DialogController($scope, $mdDialog) {
	$scope.hide = function() {
		$mdDialog.hide();
	};
	$scope.cancel = function() {
		$mdDialog.cancel();
	};
}<|endoftext|>


<commit_before>'use strict'
import React from 'react'
import lang from 'i18n/lang'
import Exporter from 'components/file/export'
import Importer from 'components/file/import'
import FileOpener from 'components/file/open'
import FileSaveAs from 'components/file/saveAs'
import './header.less'

let Header = React.createClass({
  createWidget: function (type) {
    let deck = this.props.deck
    let activeSlide = deck.getActiveSlide()
    this.props.onNewWidget(activeSlide, null,
      {
        "type": type,
        "x": 0,
        "y": 0,
        "text": "
ddx
"
      },
      lang['new'] + ' ' + lang[type])
  },
  onImport: function () {
    this.refs.importer.click()
  },
  onDelete: function(){
    this.props.onDeleteDeck()
  },
  render: function () {
    let undoTitle = lang.undo + ' ' + this.props.deck.undoStack.stack[this.props.deck.undoStack.current].desc
    let redoTitle = lang.redo + ' ' + ((this.props.deck.undoStack.current + 1 < this.props.deck.undoStack.stack.length) ? this.props.deck.undoStack.stack[this.props.deck.undoStack.current + 1].desc : '')
    return

          <button type="button" className="navbar-toggle collapsed" data-toggle="collapse"
                  data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            Toggle navigation

          </button>

            ShowPreper

{lang.undo}Ctrl-z

{lang.redo}Ctrl-y

{lang.open}

{lang.saveAs}

{lang.export}

{lang.import}

{lang.delete}

            <FileOpener onNewDeck={this.props.onNewDeck}/>
            <FileSaveAs
              onNewDeck={this.props.onNewDeck}
              deck={this.props.deck}/>
            <Exporter deck={this.props.deck}/>
            <Importer onNewDeck={this.props.onNewDeck} ref="importer"/>

            {[
              {icon: 'glyphicon-text-width', text: lang.text, type: 'TextBox'},
              {icon: 'glyphicon-picture', text: lang.image, type: 'image'},
              {icon: 'glyphicon-film', text: lang.video, type: 'video'},
              {icon: 'glyphicon-globe', text: lang.website, type: 'website'},
              {icon: 'glyphicon-star', text: lang.shapes, type: 'shapes'},
            ].map(e =>
              <button type="button" className="btn btn-default" key={e.type}
                      onClick={() => {this.createWidget(e.type)}}>

                  {e.text}

              </button>
            )}

                <button type="button"
                        className="btn btn-default"
                        onClick={()=>this.props.changeView('slides')}
                >

                    {lang.slides}

                </button>

                <button type="button"
                        className="btn btn-default"
                        onClick={()=>this.props.changeView('overview')}
                >

                    {lang.overview}

                </button>

{lang.show}

              <button type="button" className="btn btn-success dropdown-toggle" data-toggle="dropdown"
                      aria-haspopup="true" aria-expanded="false">

                Toggle Dropdown
              </button>

{lang.presentation}

{lang.handouts}

        {/**/}

      {/**/}

  }
})

module.exports = Header
<commit_msg>make deletion menu item read<commit_after>'use strict'
import React from 'react'
import lang from 'i18n/lang'
import Exporter from 'components/file/export'
import Importer from 'components/file/import'
import FileOpener from 'components/file/open'
import FileSaveAs from 'components/file/saveAs'
import './header.less'

let Header = React.createClass({
  createWidget: function (type) {
    let deck = this.props.deck
    let activeSlide = deck.getActiveSlide()
    this.props.onNewWidget(activeSlide, null,
      {
        "type": type,
        "x": 0,
        "y": 0,
        "text": "
ddx
"
      },
      lang['new'] + ' ' + lang[type])
  },
  onImport: function () {
    this.refs.importer.click()
  },
  onDelete: function(){
    this.props.onDeleteDeck()
  },
  render: function () {
    let undoTitle = lang.undo + ' ' + this.props.deck.undoStack.stack[this.props.deck.undoStack.current].desc
    let redoTitle = lang.redo + ' ' + ((this.props.deck.undoStack.current + 1 < this.props.deck.undoStack.stack.length) ? this.props.deck.undoStack.stack[this.props.deck.undoStack.current + 1].desc : '')
    return

          <button type="button" className="navbar-toggle collapsed" data-toggle="collapse"
                  data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            Toggle navigation

          </button>

            ShowPreper

{lang.undo}Ctrl-z

{lang.redo}Ctrl-y

{lang.open}

{lang.saveAs}

{lang.export}

{lang.import}

{lang.delete}

            <FileOpener onNewDeck={this.props.onNewDeck}/>
            <FileSaveAs
              onNewDeck={this.props.onNewDeck}
              deck={this.props.deck}/>
            <Exporter deck={this.props.deck}/>
            <Importer onNewDeck={this.props.onNewDeck} ref="importer"/>

            {[
              {icon: 'glyphicon-text-width', text: lang.text, type: 'TextBox'},
              {icon: 'glyphicon-picture', text: lang.image, type: 'image'},
              {icon: 'glyphicon-film', text: lang.video, type: 'video'},
              {icon: 'glyphicon-globe', text: lang.website, type: 'website'},
              {icon: 'glyphicon-star', text: lang.shapes, type: 'shapes'},
            ].map(e =>
              <button type="button" className="btn btn-default" key={e.type}
                      onClick={() => {this.createWidget(e.type)}}>

                  {e.text}

              </button>
            )}

                <button type="button"
                        className="btn btn-default"
                        onClick={()=>this.props.changeView('slides')}
                >

                    {lang.slides}

                </button>

                <button type="button"
                        className="btn btn-default"
                        onClick={()=>this.props.changeView('overview')}
                >

                    {lang.overview}

                </button>

{lang.show}

              <button type="button" className="btn btn-success dropdown-toggle" data-toggle="dropdown"
                      aria-haspopup="true" aria-expanded="false">

                Toggle Dropdown
              </button>

{lang.presentation}

{lang.handouts}

        {/**/}

      {/**/}

  }
})

module.exports = Header
<|endoftext|>


<commit_before>import React from 'react';
import Notes from './notes';
import LetterLinks from './chunks/letter-links';
import {Summary} from './chunks/summary';

const PeopleComponent = ({groupedPeople}) => {
  const allFirstLetters = Object.keys(groupedPeople);
  const groupsIterable = allFirstLetters.map(key => groupedPeople[key]);

  return (

Personen

Entdecker, Pioniere, Wissenschaftler

@wolfram: pls make the filter work with FilterRows as in stars-site

@wolfram: pls let the toggle-switches for sort and filter hide each other on hover on small screens

          Naturwissenschaftler und Raumfahrer – seit Jahrtausenden entdecken und
          erobern sie neue Welten und Räume, sie erkennen Zusammenhänge und Naturgesetze.
          Als Pioniere erweitern sie ständig den Horizont der Erkenntnis.

            Claudius Ptolemäus

          Aus Schamanen und Priestern wurden Astrologen und Philosophen, später
          dann Quantenphysiker und Bordingenieure. Ihr steter Drang nach der Erforschung
          des Unbekannten sind bis heute der Motor der Wissenschaft.

          Sie stellen die entscheidenden Fragen und suchen nach deren Antworten.
          Sie sind aufmerksame Beobachter ihrer Umwelt und werten Daten aus. Neugier,
          Beharrlichkeit und Ausdauer sind Grundvoraussetzungen, um als Forscher
          nicht nur erfolgreich zu sein, sondern auch Misserfolge und Rückschläge
          zu verkraften.

          Neben den großen Namen gibt es viele unbekannte Akademiker und Amateure,
          die im kleinen und großen Maßstab Bedeutendes geleistet haben. Wie Zahnräder
          in einem Getriebe greifen ihre Arbeiten ineinander und treiben die Wissenschaft
          voran in Richtung Zukunft.

            Aristoteles, A. Shepard, I. Newton, E. Halley, V. Tereschkowa, A. Einstein, N. Kopernikus, J. Gagarin, G. Galilei, S. Hawking, T. Brahe, N. Armstrong

          Mit ihren Leistungen schreiben sie sich in die Geschichtsbücher ein.
          Auszeichnungen werden ihnen verliehen und sie stiften neue Preise. Den
          Größten zu Ehren errichten wir Monumente und benennen Universitäten und
          Mondkrater nach diesen Giganten der Wissenschaft.

            Crew der Challenger STS-51-L

          Aus dem Fall eines Apfels ein Naturgesetz abzuleiten, mit akribischer
          Denkarbeit die Relativität von Raum und Zeit zu formulieren oder jahrzehntelang
          mit riesigen Detektoren nach Elementarteilchen zu suchen, bringt die Menschheit
          ebenso voran wie die Ergebnisse biomedizinischer Forschung, die Entwicklung
          neuer Materialien oder die Reparatur eines Solarpanels an einer Raumstation.

          Institute und Raumfahrtorganisationen auf der ganzen Welt ringen um
          talentierten und motivierten Nachwuchs. Die nächsten Ingenieure und
          Wissenschaftler der MINT-Disziplinen werden die Raumfahrtantriebe der
          Zukunft entwickeln und die Geheimnisse der Dunklen Materie entschlüsseln,
          die Raumfahrer von morgen werden auf dem Mars landen. Jeder Einzelne zählt!

Wussten Sie schon?

            Der deutsche Astronom Johann Bayer (1572 - 1625) führte eine
            noch heute gebräuliche systematische Benennung von Sternen ein.

            Am Apollo-Programm und der ersten bemannten Mondlandung arbeiteten
            insgesamt etwa 400.000 Menschen mit.

            Der Kosmonaut Waleri Bykowski hält mit vier Tagen und 23 Stunden den
            Rekord für den längsten Soloflug der Raumfahrtgeschichte.

            Brain May, der Gitarrist der britischen Rockband Queen ist
            seit 2007 auch promovierter Astrophysiker.

            Sortieren

              <form id="sortPeople" className="sort-form">
                <select name="sortPeople" defaultValue="sortPeopleNameUp">
                  <option value="sortPeopleNameUp">Name ↑</option>
                  <option value="sortPeopleNameDown">Name ↓</option>
                  <option value="sortPeopleBornUp">Geburtsdatum ↑</option>// not important yet, too much items w/o dates
                  <option value="sortPeopleBornDown">Geburtsdatum ↓</option>// not important yet, too much items w/o dates
                </select>
              </form>

            Filtern

              <form id="filterPeopleByProfession" className="filter-form">
                Beruf:
                <select name="peopleProfessions" defaultValue="showAllProfessions">
                  <option value="showAllProfessions">alle</option>
                </select>
              </form>
              <form id="filterPeopleByCountry" className="filter-form">
                Land:
                <select name="peopleCountries" defaultValue="showAllCountries">
                  <option value="showAllCountries">alle</option>
                </select>
              </form>

        <LetterLinks letters={allFirstLetters} />

          {groupsIterable.map((group, idx) => <PersonGroupComponent group={group} key={idx} />)}

      <Notes />

  );
};

export default PeopleComponent;

const PersonGroupComponent = ({group}) => {
  const groupKey = group.key;
  const people = group.data;

  return (

              <p name={`#${groupKey}`}>{groupKey}

            {people.map((person, idx) => <PersonComponent person={person} key={idx} />)}

  );
};

const PersonComponent = ({person}) => {
  return (

{person.name}

{person.profession ? person.profession : ''}

{person.country}

              {person.born ?

∗ {person.born}

                  {person.died ?
† {person.died}
 : ''}

              : ''}

  );
};
<commit_msg>corrected misspelling of Brian May<commit_after>import React from 'react';
import Notes from './notes';
import LetterLinks from './chunks/letter-links';
import {Summary} from './chunks/summary';

const PeopleComponent = ({groupedPeople}) => {
  const allFirstLetters = Object.keys(groupedPeople);
  const groupsIterable = allFirstLetters.map(key => groupedPeople[key]);

  return (

Personen

Entdecker, Pioniere, Wissenschaftler

@wolfram: pls make the filter work with FilterRows as in stars-site

@wolfram: pls let the toggle-switches for sort and filter hide each other on hover on small screens

          Naturwissenschaftler und Raumfahrer – seit Jahrtausenden entdecken und
          erobern sie neue Welten und Räume, sie erkennen Zusammenhänge und Naturgesetze.
          Als Pioniere erweitern sie ständig den Horizont der Erkenntnis.

            Claudius Ptolemäus

          Aus Schamanen und Priestern wurden Astrologen und Philosophen, später
          dann Quantenphysiker und Bordingenieure. Ihr steter Drang nach der Erforschung
          des Unbekannten sind bis heute der Motor der Wissenschaft.

          Sie stellen die entscheidenden Fragen und suchen nach deren Antworten.
          Sie sind aufmerksame Beobachter ihrer Umwelt und werten Daten aus. Neugier,
          Beharrlichkeit und Ausdauer sind Grundvoraussetzungen, um als Forscher
          nicht nur erfolgreich zu sein, sondern auch Misserfolge und Rückschläge
          zu verkraften.

          Neben den großen Namen gibt es viele unbekannte Akademiker und Amateure,
          die im kleinen und großen Maßstab Bedeutendes geleistet haben. Wie Zahnräder
          in einem Getriebe greifen ihre Arbeiten ineinander und treiben die Wissenschaft
          voran in Richtung Zukunft.

            Aristoteles, A. Shepard, I. Newton, E. Halley, V. Tereschkowa, A. Einstein, N. Kopernikus, J. Gagarin, G. Galilei, S. Hawking, T. Brahe, N. Armstrong

          Mit ihren Leistungen schreiben sie sich in die Geschichtsbücher ein.
          Auszeichnungen werden ihnen verliehen und sie stiften neue Preise. Den
          Größten zu Ehren errichten wir Monumente und benennen Universitäten und
          Mondkrater nach diesen Giganten der Wissenschaft.

            Crew der Challenger STS-51-L

          Aus dem Fall eines Apfels ein Naturgesetz abzuleiten, mit akribischer
          Denkarbeit die Relativität von Raum und Zeit zu formulieren oder jahrzehntelang
          mit riesigen Detektoren nach Elementarteilchen zu suchen, bringt die Menschheit
          ebenso voran wie die Ergebnisse biomedizinischer Forschung, die Entwicklung
          neuer Materialien oder die Reparatur eines Solarpanels an einer Raumstation.

          Institute und Raumfahrtorganisationen auf der ganzen Welt ringen um
          talentierten und motivierten Nachwuchs. Die nächsten Ingenieure und
          Wissenschaftler der MINT-Disziplinen werden die Raumfahrtantriebe der
          Zukunft entwickeln und die Geheimnisse der Dunklen Materie entschlüsseln,
          die Raumfahrer von morgen werden auf dem Mars landen. Jeder Einzelne zählt!

Wussten Sie schon?

            Der deutsche Astronom Johann Bayer (1572 - 1625) führte eine
            noch heute gebräuliche systematische Benennung von Sternen ein.

            Am Apollo-Programm und der ersten bemannten Mondlandung arbeiteten
            insgesamt etwa 400.000 Menschen mit.

            Der Kosmonaut Waleri Bykowski hält mit vier Tagen und 23 Stunden den
            Rekord für den längsten Soloflug der Raumfahrtgeschichte.

            Brian May, der Gitarrist der britischen Rockband Queen ist
            seit 2007 auch promovierter Astrophysiker.

            Sortieren

              <form id="sortPeople" className="sort-form">
                <select name="sortPeople" defaultValue="sortPeopleNameUp">
                  <option value="sortPeopleNameUp">Name ↑</option>
                  <option value="sortPeopleNameDown">Name ↓</option>
                  <option value="sortPeopleBornUp">Geburtsdatum ↑</option>// not important yet, too much items w/o dates
                  <option value="sortPeopleBornDown">Geburtsdatum ↓</option>// not important yet, too much items w/o dates
                </select>
              </form>

            Filtern

              <form id="filterPeopleByProfession" className="filter-form">
                Beruf:
                <select name="peopleProfessions" defaultValue="showAllProfessions">
                  <option value="showAllProfessions">alle</option>
                </select>
              </form>
              <form id="filterPeopleByCountry" className="filter-form">
                Land:
                <select name="peopleCountries" defaultValue="showAllCountries">
                  <option value="showAllCountries">alle</option>
                </select>
              </form>

        <LetterLinks letters={allFirstLetters} />

          {groupsIterable.map((group, idx) => <PersonGroupComponent group={group} key={idx} />)}

      <Notes />

  );
};

export default PeopleComponent;

const PersonGroupComponent = ({group}) => {
  const groupKey = group.key;
  const people = group.data;

  return (

              <p name={`#${groupKey}`}>{groupKey}

            {people.map((person, idx) => <PersonComponent person={person} key={idx} />)}

  );
};

const PersonComponent = ({person}) => {
  return (

{person.name}

{person.profession ? person.profession : ''}

{person.country}

              {person.born ?

∗ {person.born}

                  {person.died ?
† {person.died}
 : ''}

              : ''}

  );
};
<|endoftext|>


<commit_before>export var styles = {
  errorBox: {
    fontFamily: "sans-serif",
    border: 1,
    borderColor: "#FF3131",
    borderStyle: "dashed",
    padding: 3,
    borderRadius: 3,
    background: "#FFF2F2",
    position: "relative",
    top: 8,
    left: 6,
  },
  logos: {
    container: {
      display: "flex",
      height: "inherit",
    },
    toolbar: {
      height: "80%",
      alignSelf: "center",
      paddingLeft: 15,
      paddingRight: 15,
    },
  },
  spinners: {
    toolbar: {
      height: 30,
    },
    window: {
      paddingTop: 110,
      paddingBottom: 80,
      height: 50,
      width: "auto",
      margin: "auto",
      display: "flex",
    },
  },
  toolbar: {
    base: {
      display: "flex",
      justifyContent: "space-between",
      backgroundColor: "#C0C0C0",
      height: 40,
    },
    tools: {
      height: "inherit",
      display: "flex",
      justifyContent: "flex-start",
    },
    controls: {
      height: "inherit",
      display: "flex",
      justifyContent: "flex-end",
    },
  },
  forms: {
    width: 194,
  },
  buttons: {
    base: {
      display: "flex",
      justifyContent: "space-around",
      alignItems: "center",
      width: 150,
      border: "none",
      fontSize:"15px",
      fontFamily: "sans-serif",
      color: "white",
    },
    toolbar: {
      width: 120,
      backgroundColor: "gray",
    },
    run: {
      waiting: {
        backgroundColor: "#317BCF"
      },
      running: {
        color: "gray",
      },
    },
    stop: {
      stopping: {
        backgroundColor: "#FF0000",
        color: "white",
      },
      waiting: {
        color: "gray",
      },
    },
    more: {
      moreButton:{
        height: 40,
        position: "absolute",
        marginLeft: 3,
        justifyContent: "center",
      },
      menuContainer: {
        display: "flex",
        flexDirection: "column",
        position: "absolute",
        marginTop: 40,
        marginLeft: 3,
        zIndex: 1,
      },
      menuItems: {
        height: 40,
        color: "black",
        backgroundColor: "#EFEFEF",
        textDecoration: "none",
      },
    },
    googleDrive: {
      float: "left",
      width: 194,
      backgroundColor: "gray"
    },
  },
  linkStyle: {
    textDecoration: "none",
    color: "black",
  },
};
<commit_msg>update window spinner to horizon spec<commit_after>export var styles = {
  errorBox: {
    fontFamily: "sans-serif",
    border: 1,
    borderColor: "#FF3131",
    borderStyle: "dashed",
    padding: 3,
    borderRadius: 3,
    background: "#FFF2F2",
    position: "relative",
    top: 8,
    left: 6,
  },
  logos: {
    container: {
      display: "flex",
      height: "inherit",
    },
    toolbar: {
      height: "80%",
      alignSelf: "center",
      paddingLeft: 15,
      paddingRight: 15,
    },
  },
  spinners: {
    toolbar: {
      height: 30,
    },
    window: {
      paddingTop: 200,
      height: 50,
      width: "auto",
      margin: "auto",
      display: "flex",
    },
  },
  toolbar: {
    base: {
      display: "flex",
      justifyContent: "space-between",
      backgroundColor: "#C0C0C0",
      height: 40,
    },
    tools: {
      height: "inherit",
      display: "flex",
      justifyContent: "flex-start",
    },
    controls: {
      height: "inherit",
      display: "flex",
      justifyContent: "flex-end",
    },
  },
  forms: {
    width: 194,
  },
  buttons: {
    base: {
      display: "flex",
      justifyContent: "space-around",
      alignItems: "center",
      width: 150,
      border: "none",
      fontSize:"15px",
      fontFamily: "sans-serif",
      color: "white",
    },
    toolbar: {
      width: 120,
      backgroundColor: "gray",
    },
    run: {
      waiting: {
        backgroundColor: "#317BCF"
      },
      running: {
        color: "gray",
      },
    },
    stop: {
      stopping: {
        backgroundColor: "#FF0000",
        color: "white",
      },
      waiting: {
        color: "gray",
      },
    },
    more: {
      moreButton:{
        height: 40,
        position: "absolute",
        marginLeft: 3,
        justifyContent: "center",
      },
      menuContainer: {
        display: "flex",
        flexDirection: "column",
        position: "absolute",
        marginTop: 40,
        marginLeft: 3,
        zIndex: 1,
      },
      menuItems: {
        height: 40,
        color: "black",
        backgroundColor: "#EFEFEF",
        textDecoration: "none",
      },
    },
    googleDrive: {
      float: "left",
      width: 194,
      backgroundColor: "gray"
    },
  },
  linkStyle: {
    textDecoration: "none",
    color: "black",
  },
};
<|endoftext|>


<commit_before>import DOM from './DefaultDOMElement'
import _isTextNodeEmpty from './_isTextNodeEmpty'
import isString from '../util/isString'

export default function prettyPrintXML (xml) {
  let dom
  if (isString(xml)) {
    dom = DOM.parseXML(xml)
  } else {
    dom = xml
  }
  const result = []
  // Note: the browser treats XML instructions in a surprising way:
  // parsing `<?xml version="1.0" encoding="UTF-8"?><dummy/>` results in only one element
  // i.e. the instruction is swallowed and stored in a way that it is created during serialization.
  // Interestingly, this is not the case for the DOCTYPE declaration.
  // ATTENTION: we have assimilated the MemoryDOM implementation, so that we get the same result.
  const childNodes = dom.getChildNodes()
  if (dom.isDocumentNode()) {
    const xml = dom.empty().serialize()
    if (/<\?\s*xml/.exec(xml)) {
      result.push(xml)
    }
  }
  childNodes.forEach(el => {
    _prettyPrint(result, el, 0)
  })
  return result.join('\n')
}

function _prettyPrint (result, el, level) {
  const indent = new Array(level * 2).fill(' ').join('')
  if (el.isElementNode()) {
    const isMixed = _isMixed(el)
    const containsCDATA = _containsCDATA(el)
    if (isMixed || containsCDATA) {
      result.push(indent + el.outerHTML)
    } else {
      const children = el.children
      const tagName = el.tagName
      const tagStr = [`<${tagName}`]
      el.getAttributes().forEach((val, name) => {
        tagStr.push(`${name}="${val}"`)
      })
      if (children.length > 0) {
        result.push(indent + tagStr.join(' ') + '>')
        el.children.forEach((child) => {
          _prettyPrint(result, child, level + 1)
        })
        result.push(indent + `</${tagName}>`)
      } else {
        result.push(indent + tagStr.join(' ') + ' />')
      }
    }
  } else if (level === 0 && el.isTextNode()) {
    // skip text outside of the root element
  } else {
    result.push(indent + el.outerHTML)
  }
}

function _isMixed (el) {
  const childNodes = el.childNodes
  for (let i = 0; i < childNodes.length; i++) {
    const child = childNodes[i]
    if (child.isTextNode() && !_isTextNodeEmpty(child)) {
      return true
    }
  }
}

function _containsCDATA (el) {
  const childNodes = el.childNodes
  for (let i = 0; i < childNodes.length; i++) {
    const child = childNodes[i]
    if (child.getNodeType() === 'cdata') {
      return true
    }
  }
}
<commit_msg>Fix prettyPrintXML.<commit_after>import DOM from './DefaultDOMElement'
import _isTextNodeEmpty from './_isTextNodeEmpty'
import isString from '../util/isString'

export default function prettyPrintXML (xml) {
  let dom
  if (isString(xml)) {
    dom = DOM.parseXML(xml)
  } else {
    dom = xml
  }
  const result = []
  // Note: the browser treats XML instructions in a surprising way:
  // parsing `<?xml version="1.0" encoding="UTF-8"?><dummy/>` results in only one element
  // i.e. the instruction is swallowed and stored in a way that it is created during serialization.
  // Interestingly, this is not the case for the DOCTYPE declaration.
  // ATTENTION: we have assimilated the MemoryDOM implementation, so that we get the same result.
  if (dom.isDocumentNode()) {
    const childNodes = dom.getChildNodes()
    const xml = dom.empty().serialize()
    if (/<\?\s*xml/.exec(xml)) {
      result.push(xml)
    }
    childNodes.forEach(el => {
      _prettyPrint(result, el, 0)
    })
  } else {
    _prettyPrint(result, dom, 0)
  }
  return result.join('\n')
}

function _prettyPrint (result, el, level) {
  const indent = new Array(level * 2).fill(' ').join('')
  if (el.isElementNode()) {
    const isMixed = _isMixed(el)
    const containsCDATA = _containsCDATA(el)
    if (isMixed || containsCDATA) {
      result.push(indent + el.outerHTML)
    } else {
      const children = el.children
      const tagName = el.tagName
      const tagStr = [`<${tagName}`]
      el.getAttributes().forEach((val, name) => {
        tagStr.push(`${name}="${val}"`)
      })
      if (children.length > 0) {
        result.push(indent + tagStr.join(' ') + '>')
        el.children.forEach((child) => {
          _prettyPrint(result, child, level + 1)
        })
        result.push(indent + `</${tagName}>`)
      } else {
        result.push(indent + tagStr.join(' ') + ' />')
      }
    }
  } else if (level === 0 && el.isTextNode()) {
    // skip text outside of the root element
  } else {
    result.push(indent + el.outerHTML)
  }
}

function _isMixed (el) {
  const childNodes = el.childNodes
  for (let i = 0; i < childNodes.length; i++) {
    const child = childNodes[i]
    if (child.isTextNode() && !_isTextNodeEmpty(child)) {
      return true
    }
  }
}

function _containsCDATA (el) {
  const childNodes = el.childNodes
  for (let i = 0; i < childNodes.length; i++) {
    const child = childNodes[i]
    if (child.getNodeType() === 'cdata') {
      return true
    }
  }
}
<|endoftext|>


<commit_before>// ==UserScript==
// @name           douban4xuandy
// @grant          GM_xmlhttpRequest
// @description    douban score for www.xuandy.com movie
// @include        http://www.xuandy.com/movie/*
// author          kelvingu616@gmail.com
// github          goorockey/douban4xuandy
// ==/UserScript==

var douban_search_url = 'https://api.douban.com/v2/movie/search?count=10&q=';
var douban_movie_url = 'http://movie.douban.com/subject/'

var insertDoubanScore = function(douban_data) {
    if (douban_data === undefined) {
        return;
    }

    var score = douban_data.rating.average;
    var link = douban_movie_url + douban_data.id;

    var a = document.createElement('a');
    a.appendChild(document.createTextNode('豆瓣评分: ' + score));
    a.href = link;
    a.style.color = 'red';

    document.getElementsByClassName('postmeat')[0].appendChild(a);
};

var parseDoubanData = function (movie_name, data) {
    if (!data || !data.subjects) {
        return ;
    }

    data = data.subjects;
    for (var i = 0; i < data.length; i++) {
        if (data[i].title === movie_name) {
            return data[i];
        }
    }
};

var getDoubanScore = function (movie_name, callback) {
    GM_xmlhttpRequest({
        method: 'GET',
        headers: {
            'Accept': 'application/json'
        },
        url: douban_search_url + movie_name,
        onload: function (res) {
            if (res.status !== 200) {
                return ;
            }
            try {
                var data = JSON.parse(res.responseText);
                return callback(parseDoubanData(movie_name, data));
            } catch (e) {
                console.log(e);
            }
        },
    });
};

var getMovieName = function () {
    var title = document.getElementsByClassName('post') [0].childNodes[1].innerHTML;
    var re = /\u300A(.*)\u300B/; // 格式: 《电影名》
    var m = re.exec(title);
    if (!m) {
        return ;
    }
    var movie_name = m[1];
    return movie_name;
};

getDoubanScore(getMovieName(), insertDoubanScore);
<commit_msg>update header of douban4xuandy.user.js<commit_after>// ==UserScript==
// @name        douban4xuandy
// @grant       GM_xmlhttpRequest
// @description douban score for www.xuandy.com movie
// @include     http://www.xuandy.com/movie/*
// @include     http://www.xuandy.com/television/*
// @include     http://www.xuandy.com/video/*
// author       kelvingu616@gmail.com
// github       github.com/goorockey
// ==/UserScript==

var douban_search_url = 'https://api.douban.com/v2/movie/search?count=10&q=';
var douban_movie_url = 'http://movie.douban.com/subject/';

var insertDoubanScore = function(douban_data) {
    if (douban_data === undefined) {
        return;
    }

    var score = douban_data.rating.average;
    var link = douban_movie_url + douban_data.id;

    var a = document.createElement('a');
    a.appendChild(document.createTextNode('豆瓣评分: ' + score));
    a.href = link;
    a.style.color = 'red';

    document.getElementsByClassName('postmeat')[0].appendChild(a);
};

var parseDoubanData = function (movie_name, data) {
    if (!data || !data.subjects) {
        return ;
    }

    data = data.subjects;
    for (var i = 0; i < data.length; i++) {
        if (data[i].title === movie_name) {
            return data[i];
        }
    }
};

var getDoubanScore = function (movie_name, callback) {
    GM_xmlhttpRequest({
        method: 'GET',
        headers: {
            'Accept': 'application/json'
        },
        url: douban_search_url + movie_name,
        onload: function (res) {
            if (res.status !== 200) {
                return ;
            }
            try {
                var data = JSON.parse(res.responseText);
                return callback(parseDoubanData(movie_name, data));
            } catch (e) {
                console.log(e);
            }
        },
    });
};

var getMovieName = function () {
    var title = document.getElementsByClassName('post') [0].childNodes[1].innerHTML;
    var re = /\u300A(.*)\u300B/; // 格式: 《电影名》
    var m = re.exec(title);
    if (!m) {
        return ;
    }
    var movie_name = m[1];
    return movie_name;
};

getDoubanScore(getMovieName(), insertDoubanScore);
<|endoftext|>


<commit_before>(function () {
    'use strict';

    angular.module('testApp.routes', ['ngRoute'])
        .config([
            '$routeProvider', '$locationProvider',
            function ($routeProvider, $locationProvider) {
                $routeProvider.
                    when('/tbGridPagerTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbGridPager_tests.html',
                        title: 'Tubular Grid Pager (and related) Tests'
                    })
                    .when('/tbColumnTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbColumn_tests.html',
                        title: 'Tubular Column Tests'
                    })
                    .when('/tbFiltersTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFilters_tests.html',
                        title: 'Tubular Column Tests'
                    })
                    .when('/tbFormTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbForm_tests.html',
                        title: 'Tubular Form Tests'
                    })
                    .when('/tbFormSavingTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormSaving_tests.html',
                        title: 'Tubular Form Saving Tests'
                    })
                    .when('/tbGridComponentsTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbGridComponent_tests.html',
                        title: 'Tubular Grid Components Tests'
                    })
                    .when('/tbODataTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbOData_tests.html',
                        title: 'Tubular Grid OData Tests'
                    })
                    .when('/tbLocalDataTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbLocalData_tests.html',
                        title: 'Tubular Grid Local Data Tests'
                    })
                    .when('/tbSingleFormTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbSingleForm_tests.html',
                        title: 'Tubular Single Form Tests'
                    })
                    .when('/tbEmptyFormTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbEmptyForm_tests.html',
                        title: 'Tubular Empty Form Tests'
                    })
                    .when('/Login', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/login.html',
                        title: 'Login'
                    })
                    .when('/tbFormConnErrorNoModelKeyTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormConnErrorNoModelKey_tests.html',
                        title: 'Tubular Form Loading Test'
                    })
                    .when('/tbFormConnErrorNoServerUrlTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormConnErrorNoServerUrl_tests.html',
                        title: 'Tubular Form Loading Test'
                    })
                    .when('/tbFormConnErrorNoServerUrlTests2', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormConnErrorNoServerUrl_tests2.html',
                        title: 'Tubular Form Loading Test 2'
                    })
                    .when('/expirationDate', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/expiration.html',
                        title: 'expiration test'
                    })
                    .when('/tbRowSelectable', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbRowSelectable.html',
                        title: 'selectedRows clearSelection isEmptySelection'
                    })
                    .otherwise({
                        redirectTo: '/'
                    });

                $locationProvider.html5Mode(true);
            }
        ])
        .controller("tbFormCtrl", function ($scope) {
            $scope.$on('tbForm_OnSuccessfulSave', function (event, data) {
                toastr.success(data || "Updated");
                alert("saved");
            });
            $scope.$on('tbForm_OnConnectionError', function (event, data) {
                $scope.Error = "No data found";
                toastr.error('No data found');
            });
        }).controller('LoginCtrl', [
            '$scope', '$location', 'tubularHttp',
            function ($scope, $location, tubularHttp) {
                $scope.loading = false;
                tubularHttp.tokenUrl = 'http://tubular.azurewebsites.net/token';

                $scope.submitForm = function () {
                    $scope.loading = true;

                    tubularHttp.authenticate($scope.username,
                        $scope.password,
                        function () { $location.path("/expirationDate"); },
                        function (error) {
                            $scope.isAuth = tubularHttp.isAuthenticated();
                            $scope.loading = false;
                            toastr.error(error);
                            $location.path("/expirationDate");
                        });
                };
            }
        ]).controller("navCtrl", function () {
            // TODO: Check login info
        }).controller('onSaved', function ($scope) {
            $scope.$on('tbForm_OnSuccessfulSave', function () {
                $scope.textSave = "Saved";
            });

        }).controller('expDate', [
            '$scope', 'tubularHttp', 'localStorageService',
            function ($scope, tubularHttp, localStorageService) {
                tubularHttp.setRefreshTokenUrl('http://tubular.azurewebsites.net/token');
                tubularHttp.setTokenUrl('http://tubular.azurewebsites.net/token');
                tubularHttp.setApiBaseUrl('http://tubular.azurewebsites.net/api');

                $scope.isAuthenticated = function () {
                    console.log("Auth", tubularHttp.isAuthenticated());
                    if (tubularHttp.isAuthenticated()) {
                        $scope.isAuth = "Is Authenticated";
                        return true;
                    } else {
                        $scope.isAuth = "Not Authenticated";
                        return false;
                    }
                };

                $scope.expireAccessToken = function () {
                    $scope.accessToken = tubularHttp.userData.bearerToken;
                    tubularHttp.setRequireAuthentication(true);
                    tubularHttp.setAccessTokenAsExpired();
                }

                $scope.removeAuthentication = function () {
                    tubularHttp.removeAuthentication();

                    tubularHttp.setRequireAuthentication(true);

                    if (tubularHttp.isAuthenticated()) {
                        $scope.redirected = "Authenticated";
                    } else {
                        $scope.redirected = "Not Authenticated";
                    }
                };
                $scope.retrieveData = function () {
                    var retData = tubularHttp.userData;
                    var savedDat = localStorageService.get('auth_data');
                    $scope.retSavData = retData.username === savedDat.username;
                    $scope.refreshToken = retData.refreshToken;
                };

                $scope.getTest = function () {
                    var getObject = tubularHttp.get('http://tubular.azurewebsites.net/api/orders/53');
                    if (getObject.cancel != null) {
                        $scope.getLog = "cancel";
                    }

                };

                $scope.postTest = function () {
                    tubularHttp.post('http://tubular.azurewebsites.net/api/orders/53', { 'ShipperCity': 'California' }).promise.then(function (data) {
                        $scope.postLog = data || 'null';
                    });
                };

                $scope.useRefreshToken = function () {
                    tubularHttp.setRefreshTokenUrl('http://tubular.azurewebsites.net/token');
                    tubularHttp.setTokenUrl('http://tubular.azurewebsites.net/token');
                    tubularHttp.setApiBaseUrl('http://tubular.azurewebsites.net/api');
                    tubularHttp.useRefreshTokens = true;

                    $scope.accessToken = tubularHttp.userData.bearerToken;
                    tubularHttp.setRequireAuthentication(true);
                    tubularHttp.setAccessTokenAsExpired();

                    console.log("Before going: ", tubularHttp.apiBaseUrl);

                    tubularHttp.useRefreshTokens = true;
                    var response = tubularHttp.get('http://tubular.azurewebsites.net/api/orders/10');

                    response.promise.then(function (data) {
                        console.log("Order", data);
                        $scope.accessToken = tubularHttp.userData.bearerToken;
                    });
                };
            }
        ]).controller('rwController', [
            '$scope', 'localStorageService',
            function ($scope, localStorageService) {
                $scope.selectRows = function () {
                    var rows = localStorageService.get('sampleshap1_rows');
                    $scope.rows = rows.length;
                };
            }
        ]).controller('tbColumnCtrl', [
            '$scope', 'localStorageService',
            function ($scope, localStorageService) {
                $scope.clearStorage = function () {
                    localStorageService.clearAll();
                };
            }
        ]);

    angular.module('app', [
        'tubular',
        'testApp.routes'
    ]);
})();<commit_msg>adding ngmocke2e reference<commit_after>(function () {
    'use strict';

    angular.module('testApp.routes', ['ngRoute'])
        .config([
            '$routeProvider', '$locationProvider',
            function ($routeProvider, $locationProvider) {
                $routeProvider.
                    when('/tbGridPagerTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbGridPager_tests.html',
                        title: 'Tubular Grid Pager (and related) Tests'
                    })
                    .when('/tbColumnTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbColumn_tests.html',
                        title: 'Tubular Column Tests'
                    })
                    .when('/tbFiltersTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFilters_tests.html',
                        title: 'Tubular Column Tests'
                    })
                    .when('/tbFormTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbForm_tests.html',
                        title: 'Tubular Form Tests'
                    })
                    .when('/tbFormSavingTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormSaving_tests.html',
                        title: 'Tubular Form Saving Tests'
                    })
                    .when('/tbGridComponentsTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbGridComponent_tests.html',
                        title: 'Tubular Grid Components Tests'
                    })
                    .when('/tbODataTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbOData_tests.html',
                        title: 'Tubular Grid OData Tests'
                    })
                    .when('/tbLocalDataTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbLocalData_tests.html',
                        title: 'Tubular Grid Local Data Tests'
                    })
                    .when('/tbSingleFormTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbSingleForm_tests.html',
                        title: 'Tubular Single Form Tests'
                    })
                    .when('/tbEmptyFormTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbEmptyForm_tests.html',
                        title: 'Tubular Empty Form Tests'
                    })
                    .when('/Login', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/login.html',
                        title: 'Login'
                    })
                    .when('/tbFormConnErrorNoModelKeyTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormConnErrorNoModelKey_tests.html',
                        title: 'Tubular Form Loading Test'
                    })
                    .when('/tbFormConnErrorNoServerUrlTests', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormConnErrorNoServerUrl_tests.html',
                        title: 'Tubular Form Loading Test'
                    })
                    .when('/tbFormConnErrorNoServerUrlTests2', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbFormConnErrorNoServerUrl_tests2.html',
                        title: 'Tubular Form Loading Test 2'
                    })
                    .when('/expirationDate', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/expiration.html',
                        title: 'expiration test'
                    })
                    .when('/tbRowSelectable', {
                        templateUrl: '/test/Unosquare.Tubular.WebTest/common/tbRowSelectable.html',
                        title: 'selectedRows clearSelection isEmptySelection'
                    })
                    .otherwise({
                        redirectTo: '/'
                    });

                $locationProvider.html5Mode(true);
            }
        ])
        .controller("tbFormCtrl", function ($scope) {
            $scope.$on('tbForm_OnSuccessfulSave', function (event, data) {
                toastr.success(data || "Updated");
                alert("saved");
            });
            $scope.$on('tbForm_OnConnectionError', function (event, data) {
                $scope.Error = "No data found";
                toastr.error('No data found');
            });
        }).controller('LoginCtrl', [
            '$scope', '$location', 'tubularHttp',
            function ($scope, $location, tubularHttp) {
                $scope.loading = false;
                tubularHttp.tokenUrl = 'http://tubular.azurewebsites.net/token';

                $scope.submitForm = function () {
                    $scope.loading = true;

                    tubularHttp.authenticate($scope.username,
                        $scope.password,
                        function () { $location.path("/expirationDate"); },
                        function (error) {
                            $scope.isAuth = tubularHttp.isAuthenticated();
                            $scope.loading = false;
                            toastr.error(error);
                            $location.path("/expirationDate");
                        });
                };
            }
        ]).controller("navCtrl", function () {
            // TODO: Check login info
        }).controller('onSaved', function ($scope) {
            $scope.$on('tbForm_OnSuccessfulSave', function () {
                $scope.textSave = "Saved";
            });

        }).controller('expDate', [
            '$scope', 'tubularHttp', 'localStorageService',
            function ($scope, tubularHttp, localStorageService) {
                tubularHttp.setRefreshTokenUrl('http://tubular.azurewebsites.net/token');
                tubularHttp.setTokenUrl('http://tubular.azurewebsites.net/token');
                tubularHttp.setApiBaseUrl('http://tubular.azurewebsites.net/api');

                $scope.isAuthenticated = function () {
                    console.log("Auth", tubularHttp.isAuthenticated());
                    if (tubularHttp.isAuthenticated()) {
                        $scope.isAuth = "Is Authenticated";
                        return true;
                    } else {
                        $scope.isAuth = "Not Authenticated";
                        return false;
                    }
                };

                $scope.expireAccessToken = function () {
                    $scope.accessToken = tubularHttp.userData.bearerToken;
                    tubularHttp.setRequireAuthentication(true);
                    tubularHttp.setAccessTokenAsExpired();
                }

                $scope.removeAuthentication = function () {
                    tubularHttp.removeAuthentication();

                    tubularHttp.setRequireAuthentication(true);

                    if (tubularHttp.isAuthenticated()) {
                        $scope.redirected = "Authenticated";
                    } else {
                        $scope.redirected = "Not Authenticated";
                    }
                };
                $scope.retrieveData = function () {
                    var retData = tubularHttp.userData;
                    var savedDat = localStorageService.get('auth_data');
                    $scope.retSavData = retData.username === savedDat.username;
                    $scope.refreshToken = retData.refreshToken;
                };

                $scope.getTest = function () {
                    var getObject = tubularHttp.get('http://tubular.azurewebsites.net/api/orders/53');
                    if (getObject.cancel != null) {
                        $scope.getLog = "cancel";
                    }

                };

                $scope.postTest = function () {
                    tubularHttp.post('http://tubular.azurewebsites.net/api/orders/53', { 'ShipperCity': 'California' }).promise.then(function (data) {
                        $scope.postLog = data || 'null';
                    });
                };

                $scope.useRefreshToken = function () {
                    tubularHttp.setRefreshTokenUrl('http://tubular.azurewebsites.net/token');
                    tubularHttp.setTokenUrl('http://tubular.azurewebsites.net/token');
                    tubularHttp.setApiBaseUrl('http://tubular.azurewebsites.net/api');
                    tubularHttp.useRefreshTokens = true;

                    $scope.accessToken = tubularHttp.userData.bearerToken;
                    tubularHttp.setRequireAuthentication(true);
                    tubularHttp.setAccessTokenAsExpired();

                    console.log("Before going: ", tubularHttp.apiBaseUrl);

                    tubularHttp.useRefreshTokens = true;
                    var response = tubularHttp.get('http://tubular.azurewebsites.net/api/orders/10');

                    response.promise.then(function (data) {
                        console.log("Order", data);
                        $scope.accessToken = tubularHttp.userData.bearerToken;
                    });
                };
            }
        ]).controller('rwController', [
            '$scope', 'localStorageService',
            function ($scope, localStorageService) {
                $scope.selectRows = function () {
                    var rows = localStorageService.get('sampleshap1_rows');
                    $scope.rows = rows.length;
                };
            }
        ]).controller('tbColumnCtrl', [
            '$scope', 'localStorageService',
            function ($scope, localStorageService) {
                $scope.clearStorage = function () {
                    localStorageService.clearAll();
                };
            }
        ]);

    angular.module('app', [
        'tubular',
        'ngMockE2E',
        'testApp.routes'
    ]);
})();<|endoftext|>


<commit_before>function openPopover() {
	var popover = Alloy.createController('popover').getView();
	popover.show({view:$.button});
}

$.index.open();<commit_msg>make sure to only show popover on ipad<commit_after>function openPopover() {
	if (Ti.Platform.osname === 'ipad') {
		var popover = Alloy.createController('popover').getView();
		popover.show({view:$.button});
	} else {
		alert('Popover only supported on iPad');
	}
}

$.index.open();<|endoftext|>


<commit_before>import { beforeEach } from '@bigtest/mocha';
import { setupAppForTesting, visit, location } from '@bigtest/react';
import localforage from 'localforage';
import sinon from 'sinon';

// load these styles for our tests
import 'typeface-source-sans-pro';
import '@folio/stripes-components/lib/global.css';

import startMirage from '../network/start';

import App from '../../../src/App';
import * as actions from '../../../src/okapiActions';

import {
  withModules,
  clearModules,
  withConfig,
  clearConfig
} from './stripes-config';

export default function setupApplication({
  disableAuth = true,
  modules = [],
  translations = {},
  permissions = {},
  stripesConfig,
  mirageOptions,
  scenarios
} = {}) {
  beforeEach(async function () {
    const initialState = {};

    // when auth is disabled, add a fake user to the store
    if (disableAuth) {
      initialState.okapi = {
        token: 'test',
        currentUser: {
          id: 'test',
          username: 'testuser',
          firstName: 'Test',
          lastName: 'User',
          email: 'user@folio.org',
          addresses: [],
          servicePoints: []
        },
        currentPerms: {
          'perms.all': true,
          ...permissions
        }
      };
    }

    // mount the app
    this.app = await setupAppForTesting(App, {
      mountId: 'testing-root',

      props: {
        initialState
      },

      setup: () => {
        this.server = startMirage(scenarios, mirageOptions);
        this.server.logging = false;

        withModules(modules);
        withConfig({ logCategories: '', ...stripesConfig });

        sinon.stub(actions, 'setTranslations').callsFake(incoming => {
          return {
            type: 'SET_TRANSLATIONS',
            translations: Object.assign(incoming, translations)
          };
        });
      },

      teardown: () => {
        actions.setTranslations.restore();
        clearConfig();
        clearModules();
        localforage.clear();
        this.server.shutdown();
      }
    });

    // set the root to 100% height
    document.getElementById('testing-root').style.height = '100%';

    // setup react helpers
    Object.defineProperties(this, {
      visit: { value: visit },
      location: { get: location }
    });
  });
}
<commit_msg>Remove uneccessary default permissions from test setup<commit_after>import { beforeEach } from '@bigtest/mocha';
import { setupAppForTesting, visit, location } from '@bigtest/react';
import localforage from 'localforage';
import sinon from 'sinon';

// load these styles for our tests
import 'typeface-source-sans-pro';
import '@folio/stripes-components/lib/global.css';

import startMirage from '../network/start';

import App from '../../../src/App';
import * as actions from '../../../src/okapiActions';

import {
  withModules,
  clearModules,
  withConfig,
  clearConfig
} from './stripes-config';

export default function setupApplication({
  disableAuth = true,
  modules = [],
  translations = {},
  permissions = {},
  stripesConfig,
  mirageOptions,
  scenarios
} = {}) {
  beforeEach(async function () {
    const initialState = {};

    // when auth is disabled, add a fake user to the store
    if (disableAuth) {
      initialState.okapi = {
        token: 'test',
        currentUser: {
          id: 'test',
          username: 'testuser',
          firstName: 'Test',
          lastName: 'User',
          email: 'user@folio.org',
          addresses: [],
          servicePoints: []
        },
        currentPerms: permissions
      };
    }

    // mount the app
    this.app = await setupAppForTesting(App, {
      mountId: 'testing-root',

      props: {
        initialState
      },

      setup: () => {
        this.server = startMirage(scenarios, mirageOptions);
        this.server.logging = false;

        withModules(modules);
        withConfig({ logCategories: '', ...stripesConfig });

        sinon.stub(actions, 'setTranslations').callsFake(incoming => {
          return {
            type: 'SET_TRANSLATIONS',
            translations: Object.assign(incoming, translations)
          };
        });
      },

      teardown: () => {
        actions.setTranslations.restore();
        clearConfig();
        clearModules();
        localforage.clear();
        this.server.shutdown();
      }
    });

    // set the root to 100% height
    document.getElementById('testing-root').style.height = '100%';

    // setup react helpers
    Object.defineProperties(this, {
      visit: { value: visit },
      location: { get: location }
    });
  });
}
<|endoftext|>


<commit_before>// Author: Stephen Korecky
// Website: http://stephenkorecky.com
// Plugin Website: http://github.com/skorecky/Add-Clear

(function($){
  $.fn.extend({
    addClear: function(options) {
      var selector = this.selector;

      var options =  $.extend({
        closeSymbol: "✖",
        color: "#CCC",
        top: 1,
        right: 4,
        returnFocus: true,
        showOnLoad: false,
        onClear: null
      }, options);

      $(this).wrap("");
      $(this).after(""+options.closeSymbol+"");
      $("a[href='#clear']").css({
        color: options.color,
        'text-decoration': 'none',
        display: 'none',
        'line-height': 1,
        overflow: 'hidden',
        position: 'absolute',
        right: options.right,
        top: options.top
      }, this);

      if($(this).val().length >= 1 && options.showOnLoad === true) {
        $(this).siblings("a[href='#clear']").show();
      }

      $(this).keyup(function() {
        if($(this).val().length >= 1) {
          $(this).siblings("a[href='#clear']").show();
        } else {
          $(this).siblings("a[href='#clear']").hide();
        }
      });

      $("a[href='#clear']").click(function(){
        $(this).siblings(selector).val("");
        $(this).hide();
        if(options.returnFocus === true){
          $(this).siblings(selector).focus();
        }
        if (options.onClear){
          options.onClear($(this).siblings("input"));
        }
        return false;
      });
      return this;
    }
  });
})(jQuery);
<commit_msg>Add focus event show close button when focus field if value length is >= 1<commit_after>// Author: Stephen Korecky
// Website: http://stephenkorecky.com
// Plugin Website: http://github.com/skorecky/Add-Clear

(function($){
  $.fn.extend({
    addClear: function(options) {
      var selector = this.selector;

      var options =  $.extend({
        closeSymbol: "✖",
        color: "#CCC",
        top: 1,
        right: 4,
        returnFocus: true,
        showOnLoad: false,
        onClear: null
      }, options);

      $(this).wrap("");
      $(this).after(""+options.closeSymbol+"");
      $("a[href='#clear']").css({
        color: options.color,
        'text-decoration': 'none',
        display: 'none',
        'line-height': 1,
        overflow: 'hidden',
        position: 'absolute',
        right: options.right,
        top: options.top
      }, this);

      if($(this).val().length >= 1 && options.showOnLoad === true) {
        $(this).siblings("a[href='#clear']").show();
      }

      $(this).focus(function() {
        if($(this).val().length >= 1) {
          $(this).siblings("a[href='#clear']").show();
        }
      });

      $(this).keyup(function() {
        if($(this).val().length >= 1) {
          $(this).siblings("a[href='#clear']").show();
        } else {
          $(this).siblings("a[href='#clear']").hide();
        }
      });

      $("a[href='#clear']").click(function(){
        $(this).siblings(selector).val("");
        $(this).hide();
        if(options.returnFocus === true){
          $(this).siblings(selector).focus();
        }
        if (options.onClear){
          options.onClear($(this).siblings("input"));
        }
        return false;
      });
      return this;
    }
  });
})(jQuery);
<|endoftext|>


<commit_before>'use strict';

import chai from 'chai';
import RssFeedEmitter from '../../src/rss-feed-emitter.js';

let expect = chai.expect;

describe( 'RssFeedEmitter ( integration )', () => {

  /* eslint max-statements: 0 */

  describe( '#on', () => {

    let feeder;

    beforeEach( () => {

      feeder = new RssFeedEmitter();

    } );

    it( 'should emit items from "Nintendo Life"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.nintendolife.com/feeds/latest';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "BBC News"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://feeds.bbci.co.uk/news/rss.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "Time"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://feeds.feedburner.com/time/topstories?format=xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "Bloomberg"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.bloomberg.com/feed/podcast/etf-report.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "The Guardian"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.theguardian.com/world/rss';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "The Huffington Post"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.huffingtonpost.com/feeds/index.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "The New York Times"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "Reddit"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'https://www.reddit.com/.rss';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "CNN"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://rss.cnn.com/rss/edition.rss';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        // The description is not always a string, it can be null in CNN's feed:
        // expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from feed url involving redirects', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://feeds.nczonline.net/blog/';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    afterEach( () => {

      feeder.destroy();

    } );

  } );

} );
<commit_msg>test(broken): remove Bloomberg integration test (#152)<commit_after>'use strict';

import chai from 'chai';
import RssFeedEmitter from '../../src/rss-feed-emitter.js';

let expect = chai.expect;

describe( 'RssFeedEmitter ( integration )', () => {

  /* eslint max-statements: 0 */

  describe( '#on', () => {

    let feeder;

    beforeEach( () => {

      feeder = new RssFeedEmitter();

    } );

    it( 'should emit items from "Nintendo Life"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.nintendolife.com/feeds/latest';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "BBC News"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://feeds.bbci.co.uk/news/rss.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "Time"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://feeds.feedburner.com/time/topstories?format=xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "The Guardian"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.theguardian.com/world/rss';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "The Huffington Post"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://www.huffingtonpost.com/feeds/index.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "The New York Times"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "Reddit"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'https://www.reddit.com/.rss';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from "CNN"', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://rss.cnn.com/rss/edition.rss';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        // The description is not always a string, it can be null in CNN's feed:
        // expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    it( 'should emit items from feed url involving redirects', ( done ) => {

      let itemsReceived = [];
      let feedUrl = 'http://feeds.nczonline.net/blog/';

      feeder.add( {
        url: feedUrl,
        refresh: 60000
      } );

      feeder.on( 'new-item', ( item ) => {

        itemsReceived.push( item );
        expect( item.title ).to.be.a( 'string' );
        expect( item.description ).to.be.a( 'string' );
        expect( item.date ).to.be.a( 'date' );
        expect( item.meta ).to.have.property( 'link', feedUrl );

        if ( itemsReceived.length === 1 ) {

          done();

        }

      } );

    } );

    afterEach( () => {

      feeder.destroy();

    } );

  } );

} );
<|endoftext|>