<commit_before>// Test the notebook dual mode feature.

// Test
casper.notebook_test(function () {
    var a = 'print("a")';
    var index = this.append_cell(a);
    this.execute_cell_then(index);

    var b = 'print("b")';
    index = this.append_cell(b);
    this.execute_cell_then(index);

    var c = 'print("c")';
    index = this.append_cell(c);
    this.execute_cell_then(index);

    this.then(function () {
        this.validate_notebook_state('initial state', 'edit', 0);
        this.trigger_keydown('esc');
        this.validate_notebook_state('esc', 'command', 0);
        this.trigger_keydown('down');
        this.validate_notebook_state('down', 'command', 1);
        this.trigger_keydown('enter');
        this.validate_notebook_state('enter', 'edit', 1);
        this.trigger_keydown('j');
        this.validate_notebook_state('j in edit mode', 'edit', 1);
        this.trigger_keydown('esc');
        this.validate_notebook_state('esc', 'command', 1);
        this.trigger_keydown('j');
        this.validate_notebook_state('j in command mode', 'command', 2);<commit_msg>Fix for xvfb SlimerJS environment.<commit_after>// Test the notebook dual mode feature.

// Test
casper.notebook_test(function () {
    var a = 'print("a")';
    var index = this.append_cell(a);
    this.execute_cell_then(index);

    var b = 'print("b")';
    index = this.append_cell(b);
    this.execute_cell_then(index);

    var c = 'print("c")';
    index = this.append_cell(c);
    this.execute_cell_then(index);

    this.then(function () {
        this.click_cell_editor(1);
        this.click_cell_editor(0);
        this.trigger_keydown('esc');
        this.validate_notebook_state('esc', 'command', 0);
        this.trigger_keydown('down');
        this.validate_notebook_state('down', 'command', 1);
        this.trigger_keydown('enter');
        this.validate_notebook_state('enter', 'edit', 1);
        this.trigger_keydown('j');
        this.validate_notebook_state('j in edit mode', 'edit', 1);
        this.trigger_keydown('esc');
        this.validate_notebook_state('esc', 'command', 1);
        this.trigger_keydown('j');
        this.validate_notebook_state('j in command mode', 'command', 2);
{'fraction_non_alphanumeric': 0.1582766439909297, 'fraction_numerical': 0.006802721088435374, 'mean_word_length': 3.351084812623274, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4111524', 'n_tokens_mistral': 726, 'n_tokens_neox': 706, 'n_words': 127}