/// <summary>
 /// JavaScript callback. Returns current caret position.
 /// </summary>
 public InternalHandle GetCarretPos(
     V8Engine engine,
     bool isConstructCall,
     InternalHandle self,
     params InternalHandle[] args)
 {
     return(engine.CreateValue(_editor.GetCaretPosition()));
 }
示例#2
0
        public void RunCommand_ExpandsCssAbbreviation()
        {
            // Arrange
            string       result = string.Empty;
            IEmmetEditor editor = Substitute.For <IEmmetEditor>();

            editor.GetContentTypeInActiveBuffer().Returns("css");
            editor.GetContent().Returns("p10");
            editor.GetSelectionRange().Returns(new Range(3, 3));
            editor.GetCurrentLineRange().Returns(new Range(0, 3));
            editor.GetCaretPosition().Returns(3);
            editor.ReplaceContentRange(Arg.Do <string>(s => result = s), Arg.Any <int>(), Arg.Any <int>());

            // Act
            _engine.RunCommand(PackageIds.CmdIDExpandAbbreviation, editor).Should().BeTrue();
            result.Should().Be("padding: 10px;");
        }