Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 16d2151

Browse files
committed
Merge pull request #3316 from adobe/jasonsanjose/issue-3307
Change live development unit test assumptions after HTML highlight changes
2 parents 2095303 + ca51529 commit 16d2151

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

src/language/HTMLInstrumentation.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ define(function (require, exports, module) {
4444

4545
var DOMHelpers = require("LiveDevelopment/Agents/DOMHelpers");
4646

47-
// Unique ID assigned to every tag.
48-
var _tagID = 1;
49-
5047
// Hash of scanned documents. Key is the full path of the doc. Value is an object
5148
// with two properties: timestamp and tags. Timestamp is the document timestamp,
5249
// tags is an array of tag info with start, length, and tagID properties.
@@ -84,7 +81,8 @@ define(function (require, exports, module) {
8481
}
8582
}
8683

87-
var text = doc.getText();
84+
var text = doc.getText(),
85+
tagID = 1;
8886

8987
// Scan
9088
var tags = [];
@@ -112,7 +110,7 @@ define(function (require, exports, module) {
112110
if (/(img|input)/i.test(payload.nodeName)) {
113111
tags.push({
114112
name: payload.nodeName,
115-
tagID: _tagID++,
113+
tagID: tagID++,
116114
offset: payload.sourceOffset,
117115
length: payload.sourceLength
118116
});
@@ -133,7 +131,7 @@ define(function (require, exports, module) {
133131
if (startTag) {
134132
tags.push({
135133
name: startTag.nodeName,
136-
tagID: _tagID++,
134+
tagID: tagID++,
137135
offset: startTag.sourceOffset,
138136
length: payload.sourceLength + payload.sourceOffset - startTag.sourceOffset
139137
});
@@ -153,7 +151,7 @@ define(function (require, exports, module) {
153151
// Push the unclosed tag with the "unclosed" length.
154152
tags.push({
155153
name: tag.nodeName,
156-
tagID: _tagID++,
154+
tagID: tagID++,
157155
offset: tag.sourceOffset,
158156
length: tag.unclosedLength || tag.sourceLength
159157
});

test/spec/LiveDevelopment-test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,11 @@ define(function (require, exports, module) {
377377
}, "LiveDevelopment STATUS_OUT_OF_SYNC and DOMAgent.root", 10000);
378378

379379
// Grab the node that we've just modified in Brackets.
380-
// Verify that we get the original text and not modified text.
380+
// Verify that we get the modified text in memory and not the original text on disk.
381381
var originalNode;
382382
runs(function () {
383-
originalNode = DOMAgent.nodeAtLocation(230);
384-
expect(originalNode.value).toBe("Brackets is awesome!");
383+
originalNode = DOMAgent.nodeAtLocation(325);
384+
expect(originalNode.value).toBe("Live Preview in Brackets is awesome!");
385385
});
386386

387387
// wait for LiveDevelopment to unload and reload agents after saving
@@ -406,12 +406,11 @@ define(function (require, exports, module) {
406406
}, "LiveDevelopment re-load and re-activate", 10000);
407407

408408
// Grab the node that we've modified in Brackets.
409-
// This time we should have modified text since the file has been saved in Brackets.
410409
var updatedNode, doneSyncing = false;
411410
runs(function () {
412411
testWindow.$(LiveDevelopment).off("statusChange", statusChangeHandler);
413412

414-
updatedNode = DOMAgent.nodeAtLocation(230);
413+
updatedNode = DOMAgent.nodeAtLocation(325);
415414
liveDoc = LiveDevelopment.getLiveDocForPath(testPath + "/simple1.css");
416415

417416
liveDoc.getSourceFromBrowser().done(function (text) {
@@ -424,7 +423,7 @@ define(function (require, exports, module) {
424423
runs(function () {
425424
expect(fixSpaces(browserCssText)).toBe(fixSpaces(localCssText));
426425

427-
// Verify that we have modified text
426+
// Verify that we still have modified text
428427
expect(updatedNode.value).toBe("Live Preview in Brackets is awesome!");
429428
});
430429

0 commit comments

Comments
 (0)