New eslint rules auto fix (#3058)
* no-implicit-coercion and no-unneeded-ternary * End every line with a semicolon * Spacing and formatting * Enabled semi-spacing * Applies npm run lint:fix to code after master merge * Fix merge issues * Switched operator-linebreak to 'before' Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
@@ -39,7 +39,7 @@ define([
|
||||
) {
|
||||
|
||||
return {
|
||||
name:"platform/commonUI/inspect",
|
||||
name: "platform/commonUI/inspect",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"templates": [
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
*/
|
||||
|
||||
define({
|
||||
BUBBLE_TEMPLATE: "<mct-container key=\"bubble\" " +
|
||||
"bubble-title=\"{{bubbleTitle}}\" " +
|
||||
"bubble-layout=\"{{bubbleLayout}}\">" +
|
||||
"<mct-include key=\"bubbleTemplate\" " +
|
||||
"ng-model=\"bubbleModel\">" +
|
||||
"</mct-include>" +
|
||||
"</mct-container>",
|
||||
BUBBLE_TEMPLATE: "<mct-container key=\"bubble\" "
|
||||
+ "bubble-title=\"{{bubbleTitle}}\" "
|
||||
+ "bubble-layout=\"{{bubbleLayout}}\">"
|
||||
+ "<mct-include key=\"bubbleTemplate\" "
|
||||
+ "ng-model=\"bubbleModel\">"
|
||||
+ "</mct-include>"
|
||||
+ "</mct-container>",
|
||||
// Options and classes for bubble
|
||||
BUBBLE_OPTIONS: {
|
||||
offsetX: 0,
|
||||
|
||||
@@ -46,9 +46,11 @@ define(
|
||||
this.showBubbleCallback = function (event) {
|
||||
self.showBubble(event);
|
||||
};
|
||||
|
||||
this.hideBubbleCallback = function (event) {
|
||||
self.hideBubble(event);
|
||||
};
|
||||
|
||||
this.trackPositionCallback = function (event) {
|
||||
self.trackPosition(event);
|
||||
};
|
||||
@@ -81,6 +83,7 @@ define(
|
||||
this.element.off('mouseleave', this.hideBubbleCallback);
|
||||
this.dismissBubble = undefined;
|
||||
}
|
||||
|
||||
// If a bubble will be shown on a timeout, cancel that
|
||||
if (this.pendingBubble) {
|
||||
this.$timeout.cancel(this.pendingBubble);
|
||||
@@ -88,6 +91,7 @@ define(
|
||||
this.element.off('mouseleave', this.hideBubbleCallback);
|
||||
this.pendingBubble = undefined;
|
||||
}
|
||||
|
||||
// Also clear mouse position so we don't have a ton of tiny
|
||||
// arrays allocated while user mouses over things
|
||||
this.mousePosition = undefined;
|
||||
@@ -126,7 +130,6 @@ define(
|
||||
this.element.on('mouseleave', this.hideBubbleCallback);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Detach any event handlers associated with this gesture.
|
||||
* @method
|
||||
|
||||
@@ -56,8 +56,8 @@ define(
|
||||
$rootScope = this.$rootScope,
|
||||
scope = $rootScope.$new(),
|
||||
span = $compile('<span></span>')(scope),
|
||||
bubbleSpaceLR = InfoConstants.BUBBLE_MARGIN_LR +
|
||||
InfoConstants.BUBBLE_MAX_WIDTH,
|
||||
bubbleSpaceLR = InfoConstants.BUBBLE_MARGIN_LR
|
||||
+ InfoConstants.BUBBLE_MAX_WIDTH,
|
||||
options,
|
||||
popup,
|
||||
bubble;
|
||||
|
||||
@@ -63,7 +63,10 @@ define(
|
||||
mockEvent.pageY = 0;
|
||||
mockScope = jasmine.createSpyObj('$scope', ['$on']);
|
||||
mockOff = jasmine.createSpy('$off');
|
||||
testMetadata = [{ name: "Test name", value: "Test value" }];
|
||||
testMetadata = [{
|
||||
name: "Test name",
|
||||
value: "Test value"
|
||||
}];
|
||||
mockHide = jasmine.createSpy('hide');
|
||||
|
||||
mockDomainObject.getModel.and.returnValue({ name: "Test Object" });
|
||||
@@ -81,7 +84,7 @@ define(
|
||||
mockElement,
|
||||
mockDomainObject
|
||||
);
|
||||
fireGesture = mockElement.on.calls.mostRecent().args[1];
|
||||
fireGesture = mockElement.on.calls.mostRecent().args[1];
|
||||
});
|
||||
|
||||
it("expect click on the representation", function () {
|
||||
@@ -104,7 +107,7 @@ define(
|
||||
|
||||
// Get the touch start on the body
|
||||
// and fire the dismiss gesture
|
||||
fireDismissGesture = mockBody.on.calls.mostRecent().args[1];
|
||||
fireDismissGesture = mockBody.on.calls.mostRecent().args[1];
|
||||
fireDismissGesture(mockEvent);
|
||||
// Expect Body to have been touched, event.preventDefault()
|
||||
// to be called, then the mockBody listener to be detached
|
||||
|
||||
@@ -64,7 +64,10 @@ define(
|
||||
);
|
||||
mockScope = jasmine.createSpyObj('$scope', ['$on']);
|
||||
mockOff = jasmine.createSpy('$off');
|
||||
testMetadata = [{ name: "Test name", value: "Test value" }];
|
||||
testMetadata = [{
|
||||
name: "Test name",
|
||||
value: "Test value"
|
||||
}];
|
||||
mockPromise = jasmine.createSpyObj('promise', ['then']);
|
||||
mockHide = jasmine.createSpy('hide');
|
||||
|
||||
@@ -93,7 +96,10 @@ define(
|
||||
});
|
||||
|
||||
it("displays an info bubble on a delay after mouseenter", function () {
|
||||
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mouseenter", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
expect(mockTimeout)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function), testDelay);
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
@@ -106,14 +112,23 @@ define(
|
||||
});
|
||||
|
||||
it("does not display info bubble if mouse leaves too soon", function () {
|
||||
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mouseleave", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mouseenter", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
fireEvent("mouseleave", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
expect(mockTimeout.cancel).toHaveBeenCalledWith(mockPromise);
|
||||
expect(mockInfoService.display).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("hides a shown bubble when mouse leaves", function () {
|
||||
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mouseenter", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockHide).not.toHaveBeenCalled(); // verify precondition
|
||||
fireEvent("mouseleave", {});
|
||||
@@ -121,9 +136,18 @@ define(
|
||||
});
|
||||
|
||||
it("tracks mouse position", function () {
|
||||
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mousemove", { clientX: 1999, clientY: 11 });
|
||||
fireEvent("mousemove", { clientX: 1984, clientY: 11 });
|
||||
fireEvent("mouseenter", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
fireEvent("mousemove", {
|
||||
clientX: 1999,
|
||||
clientY: 11
|
||||
});
|
||||
fireEvent("mousemove", {
|
||||
clientX: 1984,
|
||||
clientY: 11
|
||||
});
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
// Should have displayed at the latest observed mouse position
|
||||
expect(mockInfoService.display).toHaveBeenCalledWith(
|
||||
@@ -135,7 +159,10 @@ define(
|
||||
});
|
||||
|
||||
it("hides shown bubbles when destroyed", function () {
|
||||
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mouseenter", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
mockTimeout.calls.mostRecent().args[0]();
|
||||
expect(mockHide).not.toHaveBeenCalled(); // verify precondition
|
||||
gesture.destroy();
|
||||
@@ -143,7 +170,10 @@ define(
|
||||
});
|
||||
|
||||
it("detaches listeners when destroyed", function () {
|
||||
fireEvent("mouseenter", { clientX: 1977, clientY: 42 });
|
||||
fireEvent("mouseenter", {
|
||||
clientX: 1977,
|
||||
clientY: 42
|
||||
});
|
||||
gesture.destroy();
|
||||
mockElement.on.calls.all().forEach(function (call) {
|
||||
expect(mockElement.off).toHaveBeenCalledWith(
|
||||
|
||||
@@ -63,6 +63,7 @@ define(
|
||||
]);
|
||||
mockCompiledTemplate.and.returnValue(mockElement);
|
||||
mockElements.push(mockElement);
|
||||
|
||||
return mockCompiledTemplate;
|
||||
});
|
||||
mockRootScope.$new.and.returnValue(mockScope);
|
||||
|
||||
Reference in New Issue
Block a user