Skip to content

Commit

Permalink
ZETA-6941: Right now manual regex to change values.
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieGreenman committed Oct 20, 2023
1 parent db4ac1a commit efa8a8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/rz/angular/morph-angular-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ import { deleteHtmlElement } from '../html/delete-html-element/delete-html-eleme
import { prependHtml } from '../html/prepend-html/prepend-html';
import { appendHtml } from '../html/append-html/append-html';
import { addPropertyToHtmlTag } from './add-property-to-html-tag/add-property-to-html-tag';
import { camelCase } from 'lodash';

function convertToAngularHtmlAndPrettify(tree: any) {
const transformedTreeInHtml = toHtml(tree)
.replace('<body>','').replace('</body>','')
.replace('<html>','').replace('</html>','')
.replace('<head>','').replace('</head>','');
return prettier.format(transformedTreeInHtml, {

const formattedCode = prettier.format(transformedTreeInHtml, {
parser: "html",
plugins: [parserHtml]
});
// right now just using regex to tidy up lowercased directives
const angularFormmatedCode = formattedCode.replace(/ngif/g, 'ngIf').replace(/ngfor/g, 'ngFor');

return angularFormmatedCode;
}

export function createUnifiedTree(htmlString: string | any): any {
Expand Down
2 changes: 1 addition & 1 deletion src/rz/html/append-html/append-html.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('appendHtml' , () => {
expect(newHtmlString).toEqual(expected);
});

it.skip('should preserve the property camelCase when html possesses property', () => {
it('should preserve the property camelCase when html possesses property', () => {
const fileToBeAddedTo = `<div *ngIf="authenticated"></div>`;
const editHtmlInput: EditHtmlInput = {
fileToBeAddedTo: fileToBeAddedTo,
Expand Down

0 comments on commit efa8a8d

Please sign in to comment.