public void LibmanCompletion_Destination()
        {
            _libManConfig.Open();
            string[] expectedCompletionEntries = new[] {
                "Properties/",
                "wwwroot/",
            };

            Editor.Caret.MoveToExpression("\"libraries\"");
            Editor.Caret.MoveDown(2);
            Editor.KeyboardCommands.Type("\"destination\":");

            Helpers.Completion.WaitForCompletionEntries(Editor, expectedCompletionEntries, caseInsensitive: true);
        }
Пример #2
0
        /// <summary>
        /// Sets the contents of the manifest file by editing it in VS
        /// </summary>
        protected void SetManifestContents(string contents)
        {
            var doc = _libmanConfig.Open();

            Editor.Selection.SelectAll();
            Editor.KeyboardCommands.Delete();
            Editor.Edit.InsertTextInBuffer(contents);
            doc.Save();
        }
        public void FileSaveRestore_AddDeleteLibrary()
        {
            string projectPath = Path.Combine(SolutionRootPath, _projectName);

            _libManConfig.Delete();
            Helpers.FileIO.WaitForDeletedFile(projectPath, Path.Combine(projectPath, _libman), caseInsensitive: false, timeout: 1000);

            VisualStudio.ObjectModel.Commanding.ExecuteCommand("Project.ManageClientSideLibraries");
            Helpers.FileIO.WaitForRestoredFile(projectPath, Path.Combine(projectPath, _libman), caseInsensitive: false, timeout: 1000);

            _libManConfig = _webProject[_libman];
            _libManConfig.Open();

            string pathToLibrary = Path.Combine(SolutionRootPath, _projectName, "wwwroot", "lib", "jquery-validate");

            string[] expectedFiles = new[]
            {
                Path.Combine(pathToLibrary, "jquery.validate.js"),
                Path.Combine(pathToLibrary, "localization", "messages_ar.js"),
            };
            string addingLibraryContent   = @"{
  ""version"": ""1.0"",
  ""defaultProvider"": ""cdnjs"",
  ""libraries"": [
    {
      ""library"": ""[email protected]"",
      ""destination"": ""wwwroot/lib/jquery-validate""
    }
  ]
}";
            string deletingLibraryContent = @"{
  ""version"": ""1.0"",
  ""defaultProvider"": ""cdnjs"",
  ""libraries"": []
}";

            ReplaceFileContent(addingLibraryContent);
            Helpers.FileIO.WaitForRestoredFiles(pathToLibrary, expectedFiles, caseInsensitive: true);

            ReplaceFileContent(deletingLibraryContent);
            Helpers.FileIO.WaitForDeletedFiles(pathToLibrary, expectedFiles, caseInsensitive: true);

            ReplaceFileContent(_libmanFileContent);
        }
Пример #4
0
        protected override void DoHostTestCleanup()
        {
            ProjectTestExtension     webProject   = Solution[ProjectName];
            ProjectItemTestExtension libmanConfig = webProject[LibManManifestFile];

            if (libmanConfig != null)
            {
                CleanClientSideLibraries();

                libmanConfig.Open();
                Editor.Selection.SelectAll();
                Editor.KeyboardCommands.Delete();
                Editor.Edit.InsertTextInBuffer(_initialLibmanFileContent);

                libmanConfig.Save();
            }

            base.DoHostTestCleanup();
        }