michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if filtering the items in the call list works properly. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL); michael@0: let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; michael@0: let searchbox = $("#calls-searchbox"); michael@0: michael@0: yield reload(target); michael@0: michael@0: let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: yield promise.all([firstRecordingFinished, callListPopulated]); michael@0: michael@0: is(searchbox.value, "", michael@0: "The searchbox should be initially empty."); michael@0: is(CallsListView.visibleItems.length, 8, michael@0: "All the items should be initially visible in the calls list."); michael@0: michael@0: searchbox.focus(); michael@0: EventUtils.sendString("clear", window); michael@0: michael@0: is(searchbox.value, "clear", michael@0: "The searchbox should now contain the 'clear' string."); michael@0: is(CallsListView.visibleItems.length, 1, michael@0: "Only one item should now be visible in the calls list."); michael@0: michael@0: is(CallsListView.visibleItems[0].attachment.actor.type, CallWatcherFront.METHOD_FUNCTION, michael@0: "The visible item's type has the expected value."); michael@0: is(CallsListView.visibleItems[0].attachment.actor.name, "clearRect", michael@0: "The visible item's name has the expected value."); michael@0: is(CallsListView.visibleItems[0].attachment.actor.file, SIMPLE_CANVAS_URL, michael@0: "The visible item's file has the expected value."); michael@0: is(CallsListView.visibleItems[0].attachment.actor.line, 25, michael@0: "The visible item's line has the expected value."); michael@0: is(CallsListView.visibleItems[0].attachment.actor.argsPreview, "0, 0, 128, 128", michael@0: "The visible item's args have the expected value."); michael@0: is(CallsListView.visibleItems[0].attachment.actor.callerPreview, "ctx", michael@0: "The visible item's caller has the expected value."); michael@0: michael@0: let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); michael@0: michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: yield secondRecordingFinished; michael@0: michael@0: SnapshotsListView.selectedIndex = 1; michael@0: yield callListPopulated; michael@0: michael@0: is(searchbox.value, "clear", michael@0: "The searchbox should still contain the 'clear' string."); michael@0: is(CallsListView.visibleItems.length, 1, michael@0: "Only one item should still be visible in the calls list."); michael@0: michael@0: for (let i = 0; i < 5; i++) { michael@0: searchbox.focus(); michael@0: EventUtils.sendKey("BACK_SPACE", window); michael@0: } michael@0: michael@0: is(searchbox.value, "", michael@0: "The searchbox should now be emptied."); michael@0: is(CallsListView.visibleItems.length, 8, michael@0: "All the items should be initially visible again in the calls list."); michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }