 import Gridicons
 
 class AztecVisualTextViewTests: XCTestCase {
-    
+
+    struct Constants {
+        static let sampleText0 = "Lorem ipsum sarasum naradum taradum insumun"
+        static let sampleText1 = " patronum sitanum elanum zoipancoiamum."
+    }
+
     override func setUp() {
         super.setUp()
         // Put setup code here. This method is called before the invocation of each test method in the class.

        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    // MARK: - TextView construction


    }


    // MARK: - Blockquotes


    /// Verifies that toggling a Blockquote, when editing an empty document, inserts a Newline.
    ///
    /// Input:
    ///     - Blockquote
    ///
    /// Ref. Issue https://github.com/wordpress-mobile/AztecEditor-iOS/issues/414
    ///
    func testTogglingBlockquoteOnEmptyDocumentsInsertsNewline() {
        let textView = createTextView(withHTML: "")
        textView.toggleBlockquote(range: .zero)

        XCTAssertEqual(textView.text, "\n")
    }

    /// Verifies that toggling a Blockquote, when editing the end of a non empty document, inserts a Newline.
    ///
    /// Input:
    ///     - "Something Here"
    ///     - Selection of the end of document
    ///     - Ordered List
    ///
    /// Ref. Issue https://github.com/wordpress-mobile/AztecEditor-iOS/issues/414
    ///
    func testTogglingBlockquoteOnNonEmptyDocumentsWhenSelectedRangeIsAtTheEndOfDocumentWillInsertNewline() {
        let textView = createTextView(withHTML: Constants.sampleText0)

        textView.selectedRange = textView.text.endOfStringNSRange()
        textView.toggleBlockquote(range: .zero)
        XCTAssertEqual(textView.text, Constants.sampleText0 + "\n")

        textView.selectedRange = textView.text.endOfStringNSRange()
        textView.deleteBackward()
        textView.insertText(Constants.sampleText1)
        
        XCTAssertEqual(textView.text, Constants.sampleText0 + Constants.sampleText1 + "\n")
    }
}
