mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
9d4d7bef6b
|
@ -489,7 +489,7 @@ void ArangoClient::printErrLine (const string& s) {
|
|||
|
||||
void ArangoClient::_printLine(const string &s) {
|
||||
#ifdef _WIN32
|
||||
LPWSTR wBuf = (LPWSTR)TRI_Allocate(TRI_CORE_MEM_ZONE, (sizeof WCHAR)* (s.size() + 1), true);
|
||||
LPWSTR wBuf = (LPWSTR) TRI_Allocate(TRI_CORE_MEM_ZONE, (sizeof WCHAR)* (s.size() + 1), true);
|
||||
int wLen = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, wBuf, (int) ((sizeof WCHAR) * (s.size() + 1)));
|
||||
|
||||
if (wLen) {
|
||||
|
@ -500,11 +500,6 @@ void ArangoClient::_printLine(const string &s) {
|
|||
pos = bufferInfo.dwCursorPosition;
|
||||
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
|
||||
WriteConsoleOutputCharacterW(GetStdHandle(STD_OUTPUT_HANDLE), wBuf, (DWORD) s.size(), pos, &n);
|
||||
// Workaround recomended by
|
||||
// http://social.msdn.microsoft.com/Forums/de-DE/c16846a3-eb27-4698-80a5-6c4ecf92a799/aus-der-msdnhotline-deutsche-umlaute-in-der-console-anzeigen-standard-c?forum=visualcplusde
|
||||
// but it does not work
|
||||
// std::locale::global(std::locale("German_germany"));
|
||||
// std::cout << "esteban: " << s;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "window error: '%d' \r\n", GetLastError());
|
||||
|
@ -519,12 +514,12 @@ void ArangoClient::_printLine(const string &s) {
|
|||
|
||||
void ArangoClient::printLine (const string& s, bool forceNewLine) {
|
||||
#ifdef _WIN32
|
||||
// no, we can use std::cout as this doesn't support UTF-8 on Windows
|
||||
// no, we cannot use std::cout as this doesn't support UTF-8 on Windows
|
||||
//fprintf(stdout, "%s\r\n", s.c_str());
|
||||
TRI_vector_string_t subStrings = TRI_SplitString(s.c_str(), '\n');
|
||||
bool hasNewLines = (s.find("\n") != string::npos) | forceNewLine;
|
||||
if (hasNewLines) {
|
||||
for (int i = 0; i < subStrings._length; i++) {
|
||||
for (size_t i = 0; i < subStrings._length; i++) {
|
||||
_printLine(subStrings._buffer[i]);
|
||||
_newLine();
|
||||
}
|
||||
|
@ -539,13 +534,15 @@ void ArangoClient::printLine (const string& s, bool forceNewLine) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief prints a string to stdout, without a newline
|
||||
/// @brief prints a string to stdout, without a newline (Non-Windows only)
|
||||
/// on Windows, we'll print the line and a newline
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ArangoClient::printContinuous (const string& s) {
|
||||
// no, we can use std::cout as this doesn't support UTF-8 on Windows
|
||||
// no, we cannot use std::cout as this doesn't support UTF-8 on Windows
|
||||
#ifdef _WIN32
|
||||
printLine(s);
|
||||
// On Windows, we just print the line followed by a newline
|
||||
printLine(s, true);
|
||||
#else
|
||||
fprintf(stdout, "%s", s.c_str());
|
||||
fflush(stdout);
|
||||
|
|
|
@ -34,26 +34,6 @@
|
|||
},
|
||||
toString: function (v) {
|
||||
return v.major + '.' + v.minor + '.' + v.patch;
|
||||
},
|
||||
toStringMainLine: function (v) {
|
||||
return v.major + '.' + v.minor;
|
||||
},
|
||||
compareVersions: function (l, r) {
|
||||
if (l.major === r.major) {
|
||||
if (l.minor === r.minor) {
|
||||
if (l.patch === r.patch) {
|
||||
return 0;
|
||||
}
|
||||
return l.patch - r.patch;
|
||||
}
|
||||
return l.minor - r.minor;
|
||||
}
|
||||
return l.major - r.major;
|
||||
},
|
||||
compareVersionStrings: function (l, r) {
|
||||
l = window.versionHelper.fromString(l);
|
||||
r = window.versionHelper.fromString(r);
|
||||
return window.versionHelper.compareVersions(l, r);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -84,7 +84,10 @@
|
|||
|
||||
queryObj = {
|
||||
query: query,
|
||||
bindVars: bindVars
|
||||
bindVars: bindVars,
|
||||
options: {
|
||||
fullCount: true
|
||||
}
|
||||
};
|
||||
$.ajax({
|
||||
cache: false,
|
||||
|
|
|
@ -255,6 +255,7 @@
|
|||
"test/specs/views/documentViewSpec.js",
|
||||
"test/specs/views/graphManagementViewSpec.js",
|
||||
"test/specs/views/newLogsViewSpec.js",
|
||||
"test/specs/views/notificationViewSpec.js",
|
||||
|
||||
"test/specs/router/routerSpec.js",
|
||||
"test/specs/router/clusterRouterSpec.js",
|
||||
|
|
|
@ -56,4 +56,10 @@ describe("Arango Helper", function() {
|
|||
|
||||
});
|
||||
|
||||
describe("checking html escaping", function() {
|
||||
var input = "<&>\"'",
|
||||
expected = "<&>"'";
|
||||
expect(arangoHelper.escapeHtml(input)).toEqual(expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true, browser: true*/
|
||||
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
|
||||
/*global $*/
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
describe("The notification view", function() {
|
||||
|
||||
var view, div, fakeNotification, dummyCollection, jQueryDummy;
|
||||
|
||||
beforeEach(function() {
|
||||
div = document.createElement("div");
|
||||
div.id = "navigationBar";
|
||||
document.body.appendChild(div);
|
||||
|
||||
dummyCollection = new window.NotificationCollection();
|
||||
|
||||
fakeNotification = {
|
||||
title: "Hallo",
|
||||
date: 1398239658,
|
||||
content: "",
|
||||
priority: "",
|
||||
tags: "",
|
||||
seen: false
|
||||
};
|
||||
|
||||
view = new window.NotificationView({
|
||||
collection: dummyCollection
|
||||
});
|
||||
|
||||
view.render();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
document.body.removeChild(div);
|
||||
});
|
||||
|
||||
it("assert basics", function () {
|
||||
expect(view.events).toEqual({
|
||||
"click .navlogo #stat_hd" : "toggleNotification",
|
||||
"click .notificationItem .fa" : "removeNotification",
|
||||
"click #removeAllNotifications" : "removeAllNotifications"
|
||||
});
|
||||
});
|
||||
|
||||
it("toggleNotification should run function", function () {
|
||||
jQueryDummy = {
|
||||
toggle: function () {
|
||||
}
|
||||
};
|
||||
spyOn(jQueryDummy, "toggle");
|
||||
spyOn(window, "$").andReturn(
|
||||
jQueryDummy
|
||||
);
|
||||
view.toggleNotification();
|
||||
expect(jQueryDummy.toggle).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("toggleNotification should run function", function () {
|
||||
view.collection.add(fakeNotification);
|
||||
jQueryDummy = {
|
||||
toggle: function () {
|
||||
}
|
||||
};
|
||||
spyOn(jQueryDummy, "toggle");
|
||||
spyOn(window, "$").andReturn(
|
||||
jQueryDummy
|
||||
);
|
||||
view.toggleNotification();
|
||||
expect(jQueryDummy.toggle).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("toggleNotification should run function", function () {
|
||||
spyOn(view.collection, "reset");
|
||||
view.removeAllNotifications();
|
||||
expect(view.collection.reset).toHaveBeenCalled();
|
||||
expect($('#notification_menu').is(":visible")).toBeFalsy();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
}());
|
Loading…
Reference in New Issue