mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
[Fixed Position] Update specs
Update specs for Fixed Position view to ensure code coverage after changes for resize/reposition behavior, WTD-882.
This commit is contained in:
parent
e2af1e85a1
commit
91754f76ad
@ -322,6 +322,47 @@ define(
|
||||
expect(handle.endDrag).toEqual(jasmine.any(Function));
|
||||
});
|
||||
});
|
||||
|
||||
it("exposes a move handle", function () {
|
||||
var handle;
|
||||
|
||||
// Select something so that drag handles are expected
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
controller.select(controller.getElements()[1]);
|
||||
|
||||
// Should have a move handle
|
||||
handle = controller.moveHandle();
|
||||
|
||||
// And it should have start/continue/end drag methods
|
||||
expect(handle.startDrag).toEqual(jasmine.any(Function));
|
||||
expect(handle.continueDrag).toEqual(jasmine.any(Function));
|
||||
expect(handle.endDrag).toEqual(jasmine.any(Function));
|
||||
});
|
||||
|
||||
it("updates selection style during drag", function () {
|
||||
var oldStyle;
|
||||
|
||||
// Select something so that drag handles are expected
|
||||
testModel.modified = 1;
|
||||
findWatch("model.modified")(testModel.modified);
|
||||
controller.select(controller.getElements()[1]);
|
||||
|
||||
// Get style
|
||||
oldStyle = controller.selected().style;
|
||||
|
||||
// Start a drag gesture
|
||||
controller.moveHandle().startDrag();
|
||||
|
||||
// Haven't moved yet; style shouldn't have updated yet
|
||||
expect(controller.selected().style).toEqual(oldStyle);
|
||||
|
||||
// Drag a little
|
||||
controller.moveHandle().continueDrag([ 1000, 100 ]);
|
||||
|
||||
// Style should have been updated
|
||||
expect(controller.selected().style).not.toEqual(oldStyle);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
@ -47,6 +47,13 @@ define(
|
||||
proxy.order("top");
|
||||
expect(testElements).toEqual([{}, {}, {}, testElement]);
|
||||
});
|
||||
|
||||
it("ensures x/y values are non-negative", function () {
|
||||
proxy.x(-1);
|
||||
proxy.y(-400);
|
||||
expect(proxy.x()).toEqual(0);
|
||||
expect(proxy.y()).toEqual(0);
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -48,6 +48,7 @@ define(
|
||||
expect(testElement.y).not.toEqual(testElement.y2);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
@ -67,6 +67,10 @@ define(
|
||||
expect(proxy.y2()).toEqual(0);
|
||||
});
|
||||
|
||||
it("provides handles for both ends", function () {
|
||||
expect(new LineProxy(diagonal).handles().length).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user