summaryrefslogtreecommitdiffstats
path: root/toolkit/components/autocomplete/tests/unit/test_removeMatchAt.js
blob: c8abf0b8328fef06ca5286ab9ceb51df9812931d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function run_test() {
  let result = Cc["@mozilla.org/autocomplete/simple-result;1"].createInstance(
    Ci.nsIAutoCompleteSimpleResult
  );
  result.appendMatch("a", "");
  result.appendMatch("b", "");
  result.removeMatchAt(0);
  Assert.equal(result.matchCount, 1);
  Assert.equal(result.getValueAt(0), "b");
  result.appendMatch("c", "");
  result.removeMatchAt(1);
  Assert.equal(result.matchCount, 1);
  Assert.equal(result.getValueAt(0), "b");
  result.removeMatchAt(0);
  Assert.equal(result.matchCount, 0);
}