/**
 * Test script to validate the modified status for buffers.
 */ import * as assert from "assert" ; import * as Oni from "oni-api" ; import { createNewFile , getElementByClassName , getSelectedTabElement } from "./Common" ; export const test = async ( oni ) => { await oni . automation . waitForEditors ( ) ; await createNewFile ( "js" , oni ) ; const tabState1 = getSelectedTabElement ( { dirty : false } ) ; assert . ok ( tabState1 , "Check buffer has no modified icon" ) ; oni . automation . sendKeys ( "i" ) ; await oni . automation . waitFor ( ( ) => oni . editors . activeEditor . mode === "insert" ) ; oni . automation . sendKeys ( "Buffer has been edited." ) ; oni . automation . sendKeys ( "<esc>" ) ; await oni . automation . waitFor ( ( ) => oni . editors . activeEditor . mode === "normal" ) ; const tabState2 = getSelectedTabElement ( { dirty : true } ) ; assert . ok ( tabState2 , "Check buffer now has a modified icon" ) ; oni . automation . sendKeys ( ":" ) ; oni . automation . sendKeys ( "e buffer2" ) ; oni . automation . sendKeys ( "<enter>" ) ; await oni . automation . waitFor ( ( ) => oni . editors . activeEditor . activeBuffer . id === "2" ) ; oni . automation . sendKeys ( ":" ) ; oni . automation . sendKeys ( "buf 1" ) ; oni . automation . sendKeys ( "<enter>" ) ; await oni . automation . waitFor ( ( ) => oni . editors . activeEditor . activeBuffer . id === "1" ) ; const tabState3 = getSelectedTabElement ( { dirty : true } ) ; assert . ok ( tabState3 , "Check buffer still has modified icon after swapping" ) ; } ; export const settings = { config : { "tabs.mode" : "buffers" , } , } ;