Skip to content

Commit

Permalink
Merge branch 'main' into dropdown-appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea authored Jun 29, 2023
2 parents c5ebef3 + c8df8d8 commit 52c711e
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 4 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"**/cspell/**",
"**/assets/**",
"**/node_modules/**",
"**/support/editor/html.ts",
"*.{log,svg,snap,png,ogv,yml}",
"**/projects/i18n/languages/**"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ li > p {
}

ul li > p {
display: inline-block;
display: block;
}

li:before {
Expand All @@ -40,6 +40,7 @@ ul > li:before {
background-color: var(--tui-primary);
vertical-align: top;
box-sizing: border-box;
float: left;
}

li ul > li:before {
Expand All @@ -60,9 +61,11 @@ ol {

ol > li:before {
content: counters(item, '.') '.';
width: 1.5rem;
display: block;
margin: 0 0.75rem 0 -1.5rem;
counter-increment: item;
color: var(--tui-base-05);
vertical-align: top;
float: left;
white-space: nowrap;
}
3 changes: 2 additions & 1 deletion projects/addon-table/components/table/th/th.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
border-left: none;
}

&._sticky {
&._sticky,
:host-context(._stuck) &._sticky {
position: sticky;
z-index: 30;

Expand Down
20 changes: 19 additions & 1 deletion projects/cdk/schematics/ng-add/steps/add-taiga-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import {
ClassDeclaration,
createProject,
getMainModule,
Identifier,
Node,
ObjectLiteralExpression,
PropertyAssignment,
saveActiveProject,
setActiveProject,
SyntaxKind,
} from 'ng-morph';

import {ALL_FILES} from '../../constants';
Expand Down Expand Up @@ -145,9 +147,13 @@ function addTuiEntitiesToStandalone({

const mainClass = getComponentFromIdentifier(rootComponentIdentifier);

const optionsObject = getOptionsObject(
bootstrapOptions as Identifier | ObjectLiteralExpression,
);

if (mainClass) {
addMainModuleToRootComponent({mainClass, options, context});
addRootTuiProvidersToBootstrapFn(bootstrapOptions as ObjectLiteralExpression);
addRootTuiProvidersToBootstrapFn(optionsObject);
addExtraTuiProvidersToRootComponent({mainClass, options, standalone: true});
}
}
Expand Down Expand Up @@ -230,3 +236,15 @@ function getModules(
...(options.addAlertModule ? ALERT_MODULES : []),
];
}

function getOptionsObject(
options: Identifier | ObjectLiteralExpression,
): ObjectLiteralExpression {
if (Node.isObjectLiteralExpression(options)) {
return options;
}

const definition = options.getDefinitionNodes()[0];

return definition.getChildrenOfKind(SyntaxKind.ObjectLiteralExpression)[0];
}
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,34 @@ bootstrapApplication(AppComponent, {
`);
});

it(`[Standalone] Should add main providers to bootstrap fn (appConfig)`, async () => {
createMainWithConfig();
saveActiveProject();

const tree = await runner
.runSchematicAsync(
`ng-add-setup-project`,
{'skip-logs': process.env[`TUI_CI`] === `true`} as Partial<TuiSchema>,
host,
)
.toPromise();

expect(tree.readContent(`test/app/app.config.ts`))
.toEqual(`import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { TuiRootModule } from "@taiga-ui/core";
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
import {
provideRouter,
withEnabledBlockingInitialNavigation,
} from '@angular/router';
import { appRoutes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideRouter(appRoutes, withEnabledBlockingInitialNavigation()), importProvidersFrom(TuiRootModule, BrowserAnimationsModule)],
};`);
});

afterEach(() => {
resetActiveProject();
});
Expand Down Expand Up @@ -375,3 +403,36 @@ export class AppComponent {

createSourceFile(`test/app/app.template.html`, `<app></app>`);
}

function createMainWithConfig(): void {
createSourceFile(
`test/main.ts`,
`import { bootstrapApplication } from '@angular/platform-browser';
import {
provideRouter,
withEnabledBlockingInitialNavigation,
} from '@angular/router';
import { appRoutes } from './app/app.routes';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';
bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
`,
{overwrite: true},
);

createSourceFile(
`test/app/app.config.ts`,
`
import { ApplicationConfig } from '@angular/core';
import {
provideRouter,
withEnabledBlockingInitialNavigation,
} from '@angular/router';
import { appRoutes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideRouter(appRoutes, withEnabledBlockingInitialNavigation())],
};`,
);
}
2 changes: 2 additions & 0 deletions projects/demo-integrations/cypress/support/editor/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const HTML_EDITOR_EXAMPLE_TABLE = `<p><%2Fp><table><tbody><tr><th%20colsp

export const HTML_EDITOR_EXAMPLE_NESTED_UL = `<ul><li>1<ul><li>2<ul><li>3</li><li>4</li></ul></li></ul></li><li>5</li></ul><ol><li>1<ol><li>2<ol><li>3</li><li>4</li></ol></li></ol></li><li>5</li></ol>`;

export const HTML_EDITOR_EXAMPLE_NESTED_UL_OL = `<ol><li><p>Lorem ipsu</p><ul><li><p>ipsimk12j3j12j3i1j2'3lj;1i2oj3;o12ij3op12;ji3po12;ij3o1;2j3o12j3oi1j23oi1j2io3j12oj3o1i2j3oi12j3oi1j23oi1j23oij12oi3j12oi3j1oi2j3oi1i2j3io1j23oij123oj12o3j1o2j3o1i2j3oi12j3oi12j3</p><ul><li><p>Hello</p><ol><li><p>121212121212312eqlwjdjqwejqiwejqwijeoiqwjeoiqjweoijqwoiejqwoiejoqiwjeoiqwjeoiqjwejqwiojeoiqwjeoiqwjeoiqwjeoiqjwoiejqw</p></li><li><p>13jahdoasdqwdjqwpejpqwjepjqwpoejqpowjepoqwjepoqjwepojqwopejqwpoejqpowjeqowjeopqwjepoqwje123123jo12ij3oi12jo3kl123</p><ol><li><p>121231231;lje;kqjhs;dklqs</p><ol><li><p>123123ijo</p><ol><li><p>23</p></li><li><p>123123123123123123123123mklna;sdasd</p></li><li><p>123123123</p></li><li><p>123123</p></li><li><p>123</p></li><li><p>123</p></li><li><p>12</p></li><li><p>3</p><ol><li><p>123</p><ol><li><p>213</p><ol><li><p>123312</p></li><li><p>1232</p></li></ol></li></ol></li></ol></li></ol></li></ol></li></ol></li></ol></li><li><p>123123123<br>123123j['2<br>123k123</p></li></ul></li><li><p>123123123<br>!23213123123123</p></li></ul></li><li><p>123</p></li><li><p>2</p></li><li><p>32</p><ol><li><p>123312</p></li><li><p>23</p></li><li><p>23</p></li><li><p>213123123</p></li><li><p>12312312312</p></li><li><p>3</p></li><li><p>123</p></li><li><p>12</p></li><li><p>31</p></li><li><p>23</p></li><li><p>123123123123j12[joj;elda</p></li><li><p>sasd1k23p]12</p></li></ol></li><li><p>3</p></li><li><p>123</p></li><li><p>1</p></li><li><p>23</p></li><li><p>123</p></li><li><p>123</p></li><li><p>123</p></li><li><p>123</p></li><li><p>123</p></li><li><p>123</p></li></ol>`;

export const HTML_EDITOR_EXAMPLE_LONG_WORD_UL = `<p></p><ul><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p><p></p></li></ul><hr><ol><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p><p></p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p><ol><li><p>2</p><ol><li><p>123</p><ol><li><p>23</p><ol><li><p>213</p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li></ol></li></ol></li></ol></li></ol></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li></ol><p></p>`;

export const HTML_EDITOR_EXAMPLE_NESTED_OL_UL = `<ul><li><p>Lorem</p><ol><li><p>Ipsum</p></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">is simply</span></p></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">dummy text of</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">the printing</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">and typesetting</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">industry</span></p><p></p></li></ul></li></ul></li></ul></li></ol></li></ul><ol><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">Lorem</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">Ipsum</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">has been</span></p><ol><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">the industry's</span></p></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">standard dummy</span></p></li></ol></li></ul></li></ul></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">text ever since the 1500s</span></p></li></ol>`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
HTML_EDITOR_EXAMPLE_LONG_WORD_UL,
HTML_EDITOR_EXAMPLE_NESTED_OL_UL,
HTML_EDITOR_EXAMPLE_NESTED_UL,
HTML_EDITOR_EXAMPLE_NESTED_UL_OL,
HTML_EDITOR_EXAMPLE_PRE_CODE,
HTML_EDITOR_EXAMPLE_TABLE,
HTML_EDITOR_EXAMPLE_UL,
Expand Down Expand Up @@ -147,6 +148,15 @@ describe(`Editor API`, () => {
.matchImageSnapshot(`5-1-bullet-and-ordered-nested-list`);
});

it(`nested ul and ol`, () => {
tuiVisitEditorApiPage({content: HTML_EDITOR_EXAMPLE_NESTED_UL_OL});

tuiGetDemoContent()
.find(`tui-editor-socket.tui-example`)
.tuiWaitBeforeScreenshot()
.matchImageSnapshot(`5-1-bullet-and-ordered-nested--ol-ul-list`);
});

it(`long words`, () => {
tuiVisitEditorApiPage({content: HTML_EDITOR_EXAMPLE_LONG_WORD_UL});

Expand Down

0 comments on commit 52c711e

Please sign in to comment.