summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/boxmodel/test/browser_boxmodel_edit-position-visible-position-change.js
blob: 0cae75aaafe300c6ef05957bdb4421f95a20ec0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Tests that the 'Edit Position' button is still visible after
// layout is changed.
// see bug 1398722

const TEST_URI = `
  <div id="mydiv" style="background:tomato;
    position:absolute;
    top:10px;
    left:10px;
    width:100px;
    height:100px">
`;

add_task(async function () {
  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
  const { inspector, boxmodel } = await openLayoutView();

  await selectNode("#mydiv", inspector);
  let editPositionButton = boxmodel.document.querySelector(
    ".layout-geometry-editor"
  );

  ok(
    isNodeVisible(editPositionButton),
    "Edit Position button is visible initially"
  );

  const positionLeftTextbox = boxmodel.document.querySelector(
    ".boxmodel-editable[title=position-left]"
  );
  ok(isNodeVisible(positionLeftTextbox), "Position-left edit box exists");

  info("Change the value of position-left and submit");
  const onUpdate = waitForUpdate(inspector);
  EventUtils.synthesizeMouseAtCenter(
    positionLeftTextbox,
    {},
    boxmodel.document.defaultView
  );
  EventUtils.synthesizeKey("8", {}, boxmodel.document.defaultView);
  EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);

  await onUpdate;
  editPositionButton = boxmodel.document.querySelector(
    ".layout-geometry-editor"
  );
  ok(
    isNodeVisible(editPositionButton),
    "Edit Position button is still visible after layout change"
  );
});