Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (Array.isArray(result)) {
ret = result;
retTotal = ret.length;
retPs = retTotal;
showPage = false;
} else {
// list
ret = deepGet(result, res.reName!.list as string[], []);
if (ret == null || !Array.isArray(ret)) {
ret = [];
}
// total
const resultTotal = res.reName!.total && deepGet(result, res.reName!.total as string[], null);
retTotal = resultTotal == null ? total || 0 : +resultTotal;
}
return deepCopy(ret);
}),
);
it('should be hide group name', () => {
createComp();
page.checkCount('.sidebar-nav__group-title');
const data = deepCopy(MOCKMENUS) as Nav[];
data[0].group = false;
menuSrv.add(data);
fixture.detectChanges();
page.checkCount('.sidebar-nav__group-title', 0);
});
set item(value: any) {
if (!this._orgItem) {
this._orgItem = deepCopy(value);
}
const ret: any = {
meta: value.meta,
code: value.code.trim(),
title: this.i18n.get(value.meta.title),
summary: this.sanitizer.bypassSecurityTrustHtml(this.i18n.get(value.summary)),
browser: +value.meta.browser > 0 ? +value.meta.browser : null,
bg: value.meta.bg,
urls: value.urls,
};
this._item = ret;
}
get item() {
export function getCopyEnum(list: any[], formData: any, readOnly: boolean) {
return getEnum(deepCopy(list || []), formData, readOnly);
}
private genData() {
const item = deepCopy(this.item);
const ret: any = {
demo: item.demo,
urls: item.urls,
con: item.content[this.i18n.lang] || item.content[this.i18n.defaultLang],
};
if (ret.demo && this.codes && this.codes.length) {
this.genDemoTitle();
const toc = ret.con.toc as any[];
const apiPos = toc.findIndex(w => w.title === 'API');
toc.splice(
apiPos === -1 ? 0 : apiPos,
0,
...[
{
h: 2,
function createComp(needMockNavigateByUrl = true, callback?: () => void) {
fixture = TestBed.createComponent(TestComponent);
dl = fixture.debugElement;
context = fixture.componentInstance;
fixture.detectChanges();
router = injector.get(Router);
setSrv = injector.get(SettingsService);
menuSrv = injector.get(MenuService);
doc = injector.get(DOCUMENT);
menuSrv.add(deepCopy(MOCKMENUS));
page = new PageObject();
if (needMockNavigateByUrl) spyOn(router, 'navigateByUrl');
if (callback) callback();
}
chainSchema(schema: SFSchema, overObject: SFSchema): this {
context.schema = {
...deepCopy(schema),
properties: { a: overObject },
};
return this.dc();
}
private resetData(nowData?: {}, run = true) {
nowData = nowData || {};
const data = deepCopy(DEFAULT_VARS);
Object.keys(data).forEach(key => {
const value = nowData![`@${key}`] || data[key].default || '';
data[key].value = value === `@primary-color` ? this.color : value;
});
this.data = data;
if (run) {
this.cdr.detectChanges();
this.runLess();
}
}