Skip to content

Commit a6fdb9c

Browse files
committed
test: advanceClock
1 parent 28b24f1 commit a6fdb9c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,10 @@ function initSubscriptions() {
417417
)
418418
}
419419

420+
/**
421+
* Force update styles of minimap
422+
*/
420423
function updateStyles() {
421-
console.log("update");
422424
domStylesReader.invalidateDOMStylesCache()
423425
editorsMinimaps.forEach((minimap) => {
424426
atom.views.getView(minimap).requestForcedUpdate()

spec/minimap-element-spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,8 +1380,9 @@ describe("MinimapElement", () => {
13801380
// ###### ####### ## ## ## #### ######
13811381

13821382
describe("when the atom styles are changed", () => {
1383-
let styleElement;
1383+
let styleElement, DEBOUNCE_TIMEOUT;
13841384
beforeEach(() => {
1385+
DEBOUNCE_TIMEOUT = 300;
13851386
styleElement = document.createElement("style");
13861387
atom.styles.addStyleElement(styleElement);
13871388

@@ -1399,6 +1400,7 @@ describe("MinimapElement", () => {
13991400
it("forces a refresh with theme change", () => {
14001401

14011402
atom.themes.emitter.emit("did-change-active-themes")
1403+
advanceClock(DEBOUNCE_TIMEOUT);
14021404

14031405
waitsFor("minimap frame requested", () => {
14041406
return minimapElement.frameRequested
@@ -1412,6 +1414,7 @@ describe("MinimapElement", () => {
14121414

14131415
it("forces a refresh with style update", () => {
14141416
atom.styles.emitter.emit("did-update-style-element", styleElement)
1417+
advanceClock(DEBOUNCE_TIMEOUT);
14151418

14161419
waitsFor("minimap frame requested", () => {
14171420
return minimapElement.frameRequested
@@ -1426,6 +1429,7 @@ describe("MinimapElement", () => {
14261429
it("forces a refresh with style add", () => {
14271430

14281431
atom.styles.emitter.emit("did-add-style-element", styleElement)
1432+
advanceClock(DEBOUNCE_TIMEOUT);
14291433

14301434
waitsFor("minimap frame requested", () => {
14311435
return minimapElement.frameRequested
@@ -1440,6 +1444,7 @@ describe("MinimapElement", () => {
14401444
it("forces a refresh with style remove", () => {
14411445

14421446
atom.styles.emitter.emit("did-remove-style-element", styleElement)
1447+
advanceClock(DEBOUNCE_TIMEOUT);
14431448

14441449
waitsFor("minimap frame requested", () => {
14451450
return minimapElement.frameRequested

0 commit comments

Comments
 (0)