How to use _createElement method in Playwright Internal

Best JavaScript code snippet using playwright-internal

createDOM.js

Source:createDOM.js Github

copy

Full Screen

...14 _createMain();15 _createFooter();16}17const _createHeader = () => {18 const headerDiv = _createElement('div', ['flexRow']);19 const navBarIcon = _createElement('i', ['fas', 'fa-bars'], '', 'nav-menu-icon');20 const logoDiv = _createElement('div', ['flexRow'], '', 'logo-div');21 const tasksIcon = _createElement('i', ['fas', 'fa-thumbtack']);22 const headerText = _createElement('span', '', 'Tacklist');23 logoDiv.append(tasksIcon, headerText);24 headerDiv.append(navBarIcon, logoDiv);25 document.querySelector('header').append(headerDiv);26}27const _createSideBar = () => document.querySelector('#sideBar').append(_createSideBar_Nav(), _createSideBar_Proj());28const _createSideBar_Nav = () => {29 const navCont = _createElement('div', ['flexCol'],'','sideBarNavCont');30 const inbox = _createElement('div', ['sideBarLink', 'flexRow'], '', 'projInboxLI');31 const inboxIcon = _createElement('i', ['fas', 'fa-inbox']);32 const inboxText = _createElement('span', '', 'Inbox');33 const inboxQty = _createElement('span', '', '0', 'inbox-qty-span');34 const today = _createElement('div', ['sideBarLink', 'flexRow'], '' , 'today');35 const todayIcon = _createElement('i', ['fas', 'fa-calendar-day']);36 const todayText = _createElement('span', '', 'Today');37 const todayQty = _createElement('span', '', '0', 'today-qty-span');38 const thisWeek = _createElement('div', ['sideBarLink', 'flexRow'], '', 'thisWeek');39 const thisWeekIcon = _createElement('i', ['fas', 'fa-calendar-week']);40 const thisWeekText = _createElement('span', '', 'This Week');41 const thisWeekQty = _createElement('span', '', '0', 'thisWeek-qty-span');42 inbox.append(inboxIcon, inboxText, inboxQty);43 today.append(todayIcon, todayText, todayQty);44 thisWeek.append(thisWeekIcon, thisWeekText, thisWeekQty);45 navCont.append(inbox, today, thisWeek);46 return navCont;47}48const _createSideBar_Proj = () => {49 const projCont = _createElement('div', ['flexCol'], '', 'projCont');50 const projHeader = _createElement('div', ['flexRow'], '', 'proj-header-div');51 const projExpandIcon = _createElement('i', ['fas', 'fa-caret-down'], '', 'proj-expand-icon');52 const projHeaderText = _createElement('h4', ['flexCol'], 'Projects');53 const projList = _createElement('ul', ['projList'], '', 'projList');54 projHeader.append(projExpandIcon, projHeaderText);55 projList.append(createAddProj());56 projCont.append(projHeader, projList);57 return projCont;58}59const createAddProj = () => {60 const addProjCont = _createElement('div', '', '', 'addProj');61 const addProjIcon = _createElement('i', ['fas', 'fa-plus']);62 const addProjLI = _createElement('li', ['noMarker'], 'Add Project', 'addProjectLI');63 addProjCont.append(addProjIcon, addProjLI);64 return addProjCont;65}66const createProject = (proj) => {67 const projName = proj.getName();68 const projID = proj.getID();69 const projectElement = _createElement('div', ['projItem'], '', projID + 'ITEM');70 const liNode = _createElement('li', '', '', projID + 'LI');71 const projText = _createElement('div', '', projName);72 projText.title = projName;73 const editIcon = _createElement('i', ['far','fa-edit', 'inactive'], '', projID + 'EDIT');74 const delIcon = _createElement('i', ['far','fa-trash-alt', 'inactive'], '', projID + 'DEL');75 const projQty = _createElement('span', ['projQty'], '0');76 liNode.append(projText);77 projectElement.append(liNode, editIcon, delIcon, projQty);78 return projectElement;79}80const createProjForm = (projID) => {81 const projForm = _createElement('form', ['projForm'], '', projID + 'FORM');82 const projInput = _createElement('input', ['inputProj'], '', 'projInput');83 projInput.type = 'text';84 projInput.required = true;85 projInput.placeholder = 'Project Name';86 projInput.value = Storage.projID_exists(projID) ? Storage.getProject(projID).getName() : '';87 const saveButton = _createElement('button', ['saveButton'], '', projID + 'SAVE');88 saveButton.type = 'submit';89 const saveIcon = _createElement('i', ['fas', 'fa-check'], '');90 91 const cancelButton = _createElement('button', ['cancelButton'], '', projID + 'CANCEL');92 cancelButton.type = 'button';93 const cancelIcon = _createElement('i', ['fas', 'fa-times'], '');94 saveButton.append(saveIcon);95 cancelButton.append(cancelIcon);96 projForm.append(projInput, saveButton, cancelButton);97 return projForm;98}99const _createMain = () => {100 const mainContent = document.querySelector('#mainContent');101 const headerContainer = _createElement('div', ['flexRow', 'taskHeader'], '', '');102 const header = _createElement('h2', '', 'Inbox', 'mainHeader');103 const sortDropdown = _createElement('div', ['dropdown', 'dropdown-sort']);104 const sortDropdownMenu = _createElement('div', ['dropdown-menu', 'menu-sort']);105 106 const sortCont = _createElement('button', ['flexRow', 'sortSelCont']);107 const caretDown = _createElement('i', ['fas', 'fa-caret-down']);108 const sortText = _createElement('div', '', '', 'sortByButton');109 const byDefault = _createElement('div', ['dropdown-item'], 'Default', 'byDefault');110 const byDate = _createElement('div', ['dropdown-item'], 'Date', 'byDate');111 const byPriority = _createElement('div', ['dropdown-item'], 'Priority', 'byPriority');112 const taskList = _createElement('ul', ['taskList'], '', 'taskList');113 taskList.append(createAddTask());114 sortCont.append(caretDown, sortText);115 sortDropdownMenu.append(byDefault, byDate, byPriority);116 sortDropdown.append(sortCont, sortDropdownMenu);117 headerContainer.append(header, sortDropdown);118 mainContent.append(headerContainer, taskList);119}120const _createFooter = () => {121 const footer = document.querySelector('footer');122 const text = document.createElement('small');123 const link = document.createElement('a');124 const img = document.createElement('input');125 126 text.textContent = `\u00A9 Copyright `;127 text.textContent += new Date().getFullYear();128 text.textContent += ', sumedh-inamdar';129 link.href = 'https://github.com/sumedh-inamdar';130 link.target = '_blank';131 link.title = 'Link to personal Github';132 img.type = "image";133 img.alt = "Github";134 img.src = octocat;135 136 link.append(img);137 footer.append(text, link);138}139const createAddTask = () => {140 const addCont = _createElement('div', ['flexRow', 'task'], '', 'addTask');141 const addItemLeft = _createElement('div', ['taskItemLeft']);142 const addIcon = _createElement('i', ['fas', 'fa-plus-circle']);143 const addText = _createElement('p', '', 'Add Task', 'addText');144 addItemLeft.append(addIcon);145 addCont.append(addItemLeft, addText);146 return addCont;147}148const createTask = (task) => {149 const taskID = task.getID();150 const outerCont = _createElement('div', ['flexRow', 'taskItem'], '', taskID + 'ITEM');151 const checkCont = _createElement('div', ['taskItemLeft']);152 const taskCont = _createElement('div', ['flexCol', 'taskCont'], '', '');153 const liCont = _createElement('div', ['flexRow', 'taskLI'], '', '');154 const descPrev = _createElement('div', ['descPrev'], task.getDescription(), '');155 descPrev.title = task.getDescription();156 const scheduleCont = _createElement('div', ['flexRow', 'descPrev']);157 const markerClass = task.isCompleted() ? 'fa-check-circle' : 'fa-circle';158 const outerCircle = _createElement('i',['far', markerClass, 'check'], '', taskID + 'CHECK');159 applyPriorityColorToMarker(outerCircle, task.getPriority());160 161 const liNode = _createElement('li', ['noMarker'], task.getTitle());162 liNode.title = task.getTitle();163 if (task.isCompleted()) liNode.classList.add('strike');164 const editNode = _createElement('i', ['far','fa-edit', 'inactive'], '', taskID + 'EDIT');165 const delIcon = _createElement('i', ['far','fa-trash-alt', 'inactive'], '', taskID + 'DEL');166 167 const calIcon = _createElement('i', ['far', 'fa-calendar-alt']);168 const taskDate = _createElement('div', ['taskDate']);169 [taskDate.textContent, scheduleCont.style.color] = task.getDateDOM();170 taskDate.title = task.getDate();171 checkCont.append(outerCircle);172 liCont.append(liNode, editNode, delIcon);173 scheduleCont.append(calIcon, taskDate);174 175 taskCont.append(liCont, descPrev);176 if (taskDate.textContent) taskCont.append(scheduleCont);177 outerCont.append(checkCont, taskCont);178 179 return outerCont;180}181const applyPriorityColorToMarker = (marker, priority) => {182 if (marker.classList.contains('fa-check-circle')) marker.style.fontWeight = 'bold';183 marker.style.color = getPriorityInfo(priority)[1];184 marker.style.backgroundColor = getPriorityInfo(priority)[1] + '34';185}186const createHR = () => _createElement('hr');187const createAddTaskForm = (taskID, dispID) => {188 const taskForm = _createElement('form', ['flexCol','taskForm'], '', taskID + 'FORM');189 const taskInputCont = _createElement('div', ['flexCol', 'taskInputCont']);190 191 const titleInput = _createElement('input', '', '', 'taskTitle');192 titleInput.type = 'text';193 titleInput.required = true;194 titleInput.placeholder = 'Title';195 196 const descInput = _createElement('input', '', '', 'taskDesc');197 descInput.type = 'text';198 descInput.required = true;199 descInput.placeholder = 'Description';200 const taskButtonCont = _createElement('div', ['flexRow', 'taskButtonCont']);201 const scheduleCont = _createElement('div', ['flexRow','taskButton']);202 const calIcon = _createElement('i', ['far', 'fa-calendar-alt']);203 const dateInput = _createElement('input', ['dateInput'], 'Schedule', 'taskDate');204 dateInput.type = 'date';205 dateInput.min = Schedule().getDateToday();206 if (dispID === 'today') dateInput.value = Schedule().getDateToday();207 208 const projDropdown = _createElement('div', ['dropdown', 'dropdown-proj']);209 const projDropdownMenu = _createElement('div', ['dropdown-menu', 'menu-proj']);210 populateProjSelDropdown(projDropdownMenu);211 const projID = dispID.startsWith('proj') ? dispID : 'projInbox';212 let projCont = createProjSelectButton(projID);213 const priDropdown = _createElement('div', ['dropdown', 'dropdown-pri']);214 const priDropdownMenu = _createElement('div', ['dropdown-menu', 'menu-pri']);215 populatePriSelDropdown(priDropdownMenu);216 let priCont = createPrioritySelectButton('p4');217 218 const saveButtonCont = _createElement('div', ['flexRow']);219 const saveButton = _createElement('button', ['saveTask'], 'Save Task');220 saveButton.type = 'submit';221 const cancelButton = _createElement('button', ['cancelTask'], 'Cancel', taskID + 'CANCEL');222 223 if (Storage.taskID_exists(taskID)) {224 const currTask = Storage.getTask(taskID);225 titleInput.value = currTask.getTitle();226 descInput.value = currTask.getDescription();227 dateInput.value = currTask.getDate();228 priCont = createPrioritySelectButton(currTask.getPriority());229 }230 scheduleCont.append(calIcon, dateInput);231 projDropdown.append(projCont, projDropdownMenu);232 priDropdown.append(priCont, priDropdownMenu);233 taskButtonCont.append(scheduleCont, projDropdown, priDropdown);234 taskInputCont.append(titleInput, descInput, taskButtonCont);235 saveButtonCont.append(saveButton, cancelButton);236 taskForm.append(taskInputCont, saveButtonCont)237 return taskForm;238}239const populateProjSelDropdown = (dropdown) => {240 const projList = Storage.getProjects();241 projList.forEach(proj => {242 const inboxIcon = _createElement('i', ['fas', 'fa-inbox']);243 const projIcon = _createElement('i', ['fas', 'fa-circle']);244 let projName = proj.getName();245 let projID = proj.getID();246 let projItem = _createElement('div', ['flexRow', 'dropdown-item'], '', projID + 'dropdown');247 let icon = projID === 'projInbox' ? inboxIcon : projIcon;248 let projText = _createElement('div', '', projName);249 projText.title = projName;250 projItem.append(icon, projText);251 dropdown.append(projItem);252 })253}254const createProjSelectButton = (projID) => {255 const projCont = _createElement('button', ['flexRow', 'projSelCont', 'taskButton'], '', projID + 'SELECT');256 projCont.type = 'button';257 const inboxIcon = _createElement('i', ['fas', 'fa-inbox']);258 const projIcon = _createElement('i', ['far', 'fa-dot-circle']);259 const icon = projID === 'projInbox' ? inboxIcon : projIcon;260 const projText = _createElement('div', '', Storage.getProject(projID).getName(), projID + 'TEXT');261 262 projCont.append(icon, projText);263 264 return projCont;265}266const populatePriSelDropdown = (dropdown) => {267 const priArray = ['p1', 'p2', 'p3', 'p4'];268 priArray.forEach(pri => {269 const priItem = _createElement('div', ['flexRow', 'dropdown-item'], '', pri);270 const priText = _createElement('p', ['dropdown-item-text']);271 let icon = _createElement('i', ['fas', 'fa-flag']);272 [priText.textContent, icon.style.color] = getPriorityInfo(pri);273 274 priItem.append(icon, priText);275 dropdown.append(priItem);276 })277}278const createPrioritySelectButton = (priority) => {279 const priCont = _createElement('button', ['flexRow', 'priSelCont', 'taskButton'], '', priority + 'SELECT');280 priCont.type = 'button';281 const icon = _createElement('i', ['fas', 'fa-flag']);282 icon.style.color = getPriorityInfo(priority)[1];283 priCont.append(icon);284 return priCont;285}286const getPriorityInfo = (priority) => {287 switch (priority) {288 case 'p1':289 return ['Priority 1', '#ff3300'];290 case 'p2':291 return ['Priority 2', '#df9100'];292 case 'p3':293 return ['Priority 3', '#0000ff'];294 case 'p4':295 return ['Priority 4', 'gray'];...

Full Screen

Full Screen

crgrpt.de.gdpdu.reportindexfile.js

Source:crgrpt.de.gdpdu.reportindexfile.js Github

copy

Full Screen

1/**2 * Copyright © 2014, 2018, Oracle and/or its affiliates. All rights reserved.3 */4/**5 * Module Description6 * 7 * Version Date Author Remarks8 * 1.00 20 Nov 2013 jluzano9 *10 */11function DE_GDPDU_RI_Report(state, params, output, job) {12 13 var SuiteScript = function() { return this; } ();14 var _IS_ONEWORLD = SFC.Context.GetContext().getSetting('FEATURE', 'SUBSIDIARIES') === 'T';15 var _IS_MULTICURRENCY = SFC.Context.GetContext().getSetting('FEATURE', 'MULTICURRENCY') === 'T';16 17 var _Outline = { 'Section': __ReportIndexFile };18 var _Job = job; 19 var _Output = output;20 var _Params = params;21 var _State = state;22 var _Company = SFC.Context.GetCompanyInfo();23 var _Subsidiary = _IS_ONEWORLD ? SFC.Subsidiaries.Load(_Params.subsidiary) : null;24 var _ResMgr = new ResourceMgr(_Params.job_params.CultureId);25 var _ReportObj = this;26 this.GetOutline = function() { return _Outline; };27 28 function __ReportIndexFile() {29 30 this.On_Init = _OnInit;31 this.On_Body = _OnBody;32 this.On_CleanUp = _OnCleanUp;33 // for Unit Testing only34 this.___inspect = function(expr) { return eval('(' + expr + ')'); };35 36 var _NodeName = __ReportIndexFile.Name;37 var DEFAULTXMLDECLARATION = '<?xml version="1.0" encoding="UTF-8"?>';38 var NEWXMLDECLARATION = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE DataSet SYSTEM "gdpdu-01-08-2002.dtd">';39 var MEDIANAME = 'Disk 1';40 var RANGEFROM = '2';41 var VERSION = '1.0';42 var TAGNAMES = {43 version: 'Version',44 variablecolumn: 'VariableColumn',45 name: 'Name',46 format: 'Format',47 accuracy: 'Accuracy',48 datasupplier: 'DataSupplier',49 location: 'Location',50 comment: 'Comment',51 media: 'Media',52 table: 'Table',53 url: 'URL',54 description: 'Description',55 decimalsymbol: 'DecimalSymbol',56 digitgroupingsymbol: 'DigitGroupingSymbol',57 range: 'Range',58 from: 'From',59 variablelength: 'VariableLength',60 columndelimiter: 'ColumnDelimiter',61 foreignKey: 'ForeignKey',62 references: 'References'63 };64 65 66 function _OnInit() {67 68 _ValidateCurrencies();69 _Output.SetFileName(_GetFileName());70 if(_State[_NodeName] == undefined) {71 72 _State[_NodeName] = {73 Index: -1,74 InternalId: null75 };76 }77 _Output.SetPercent(10);78 }79 80 81 function _OnBody() {82 var w3cDocument = TAF.XML.Parser.fromString({text: '<DataSet/>'}); 83 var dataSetElement = w3cDocument.getDocumentElement();84 var versionElement = _CreateElement(TAGNAMES.version, VERSION, w3cDocument);85 var dataSupplierElement = _CreateDataSupplierElement(w3cDocument);86 var mediaElement = _CreateMediaElement(w3cDocument);87 88 dataSetElement.appendChild(versionElement);89 dataSetElement.appendChild(dataSupplierElement);90 dataSetElement.appendChild(mediaElement);91 92 _Output.WriteLine((TAF.XML.Parser.toString({document: w3cDocument})).replace(DEFAULTXMLDECLARATION, NEWXMLDECLARATION));93 _Output.SetPercent(95);94 }95 96 97 function _OnCleanUp() {98 99 delete _State[_NodeName];100 _Output.SetPercent(100);101 }102 103 104 function _CreateColumnElement(columnObj, documentObj) {105 106 var variableColumnElement = _CreateElement(TAGNAMES.variablecolumn, null, documentObj);107 variableColumnElement.appendChild(_CreateElement(TAGNAMES.name, columnObj.name, documentObj));108 109 if(columnObj.desc){110 variableColumnElement.appendChild(_CreateElement(TAGNAMES.description, columnObj.desc, documentObj));111 }112 113 var typeElement = _CreateElement(columnObj.type, null, documentObj);114 115 if (columnObj.format != null) {116 typeElement.appendChild(_CreateElement(TAGNAMES.format, columnObj.format, documentObj));117 }118 119 if (columnObj.accuracy != null && columnObj.accuracy > 0) { 120 typeElement.appendChild(_CreateElement(TAGNAMES.accuracy, columnObj.accuracy, documentObj));121 }122 123 variableColumnElement.appendChild(typeElement);124 125 return variableColumnElement;126 }127 128 129 function _CreateDataSupplierElement(documentObj) {130 131 var companyName = '';132 var companyAddress = '';133 134 if (_IS_ONEWORLD) {135 companyName = _Subsidiary.GetLegalName() == '' ? _Subsidiary.GetName() : _Subsidiary.GetLegalName();136 companyAddress = _Subsidiary.GetAddress1() + ', ' + _Subsidiary.GetState() + ', ' + _Subsidiary.GetCountryName();137 } else {138 companyName = _Company.getFieldValue('legalname') == '' ? _Company.getFieldValue('companyname') : _Company.getFieldValue('legalname');139 companyAddress = _Company.getFieldValue('address1') + ', ' + _Company.getFieldValue('state') + ', ' + _Company.getFieldText('country');140 }141 142 var dataSupplierElement = _CreateElement(TAGNAMES.datasupplier, null, documentObj);143 dataSupplierElement.appendChild(_CreateElement(TAGNAMES.name, companyName, documentObj));144 dataSupplierElement.appendChild(_CreateElement(TAGNAMES.location, companyAddress, documentObj));145 dataSupplierElement.appendChild(_CreateElement(TAGNAMES.comment, companyName, documentObj));146 147 return dataSupplierElement;148 }149 150 151 function _CreateElement(name, value, documentObj) {152 153 if (name == undefined || name == null) {154 return null;155 }156 157 var element = documentObj.createElement(name);158 159 if (value != undefined && value != null) {160 element.appendChild(documentObj.createTextNode(value));161 }162 163 return element;164 }165 166 167 function _CreateMediaElement(documentObj) {168 169 var reports = _GetReports();170 var mediaElement = _CreateElement(TAGNAMES.media, null, documentObj);171 mediaElement.appendChild(_CreateElement(TAGNAMES.name, MEDIANAME, documentObj));172 173 for (var i=0; i<reports.length; i++ ) { 174 mediaElement.appendChild(_CreateReportElement(reports[i], documentObj));175 }176 177 return mediaElement;178 }179 180 181 function _CreateReportElement(reportObj, documentObj) {182 183 var columns = reportObj.columns;184 185 var reportElement = _CreateElement(TAGNAMES.table, null, documentObj);186 reportElement.appendChild(_CreateElement(TAGNAMES.url, reportObj.url, documentObj));187 reportElement.appendChild(_CreateElement(TAGNAMES.name, reportObj.name, documentObj));188 reportElement.appendChild(_CreateElement(TAGNAMES.description, reportObj.description, documentObj));189 reportElement.appendChild(_CreateElement(TAGNAMES.decimalsymbol, reportObj.decimalsymbol, documentObj));190 reportElement.appendChild(_CreateElement(TAGNAMES.digitgroupingsymbol, reportObj.digitgroupingsymbol, documentObj));191 192 var rangeElement = _CreateElement(TAGNAMES.range, null, documentObj);193 rangeElement.appendChild(_CreateElement(TAGNAMES.from, RANGEFROM, documentObj));194 reportElement.appendChild(rangeElement);195 196 var variableLengthElement = _CreateElement(TAGNAMES.variablelength, null, documentObj);197 variableLengthElement.appendChild(_CreateElement(TAGNAMES.columndelimiter, reportObj.columndelimiter, documentObj));198 199 for (var i=0; i<columns.length; i++ ) { 200 variableLengthElement.appendChild(_CreateColumnElement(columns[i], documentObj));201 }202 203 if(reportObj.fkeyname){204 var foreignKeyElement = _CreateElement(TAGNAMES.foreignKey, null, documentObj);205 foreignKeyElement.appendChild(_CreateElement(TAGNAMES.name, reportObj.fkeyname, documentObj));206 foreignKeyElement.appendChild(_CreateElement(TAGNAMES.references, reportObj.reference, documentObj));207 variableLengthElement.appendChild(foreignKeyElement);208 }209 210 reportElement.appendChild(variableLengthElement);211 212 return reportElement;213 }214 215 216 function _GetFileName() {217 var filename = 'index.xml';218 return filename;219 }220 221 222 function _GetReports() {223 224 var reports = [];225 reports.push(new DE_GDPDU_CI_Report(_State, _Params, _Output, _Job).GetReportIndex());226 reports.push(new DE_GDPDU_AV_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());227 reports.push(new DE_GDPDU_COA_Report(_State, _Params, _Output, _Job).GetReportIndex());228 reports.push(new DE_GDPDU_GJ_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());229 reports.push(new DE_GDPDU_AR_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());230 reports.push(new DE_GDPDU_AP_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());231 reports.push(new DE_GDPDU_GL_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());232 reports.push(new DE_GDPDU_SAB_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());233 reports.push(new DE_GODB_RMD_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());234 reports.push(new DE_GODB_PMD_TXT_Report(_State, _Params, _Output, _Job).GetReportIndex());235 236 return reports;237 }238 239 240 function _ValidateCurrencies() {241 242 if (_IS_MULTICURRENCY && _IS_ONEWORLD && _Params.include_child_subs) {243 244 // Check if all subsidiaries use the same currency245 var invalidCurrencySubs = [];246 var descendants = _Subsidiary.GetDescendants();247 var currencyCode = _Subsidiary.GetCurrencyCode();248 for ( var i = 0; i < descendants.length; ++i) {249 if (currencyCode != descendants[i].GetCurrencyCode()) {250 invalidCurrencySubs.push(descendants[i].GetName());251 }252 }253 254 if (invalidCurrencySubs.length > 0) {255 256 throw SuiteScript.nlapiCreateError('DE_AUDIT_Currency_Check', _ResMgr.GetString('ERR_CURRENCY_CHECK', {'subsidiaries': invalidCurrencySubs.join(', ')}), true);257 }258 }259 }260 261 } __ReportIndexFile.Name = 'ReportIndexFile';262}263DE_GDPDU_RI_Report.IsCRGReport = true;...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

...77 residents78 }) => {79 demo++;80 let residentsArr = residents;81 let residentTr = this._createElement({tagName: 'tr'});82 let residentTd = this._createElement({dataAttributes: {colspan: '6'}, tagName: 'td', classes: ['hiddenRow']});83 let headBlock = this._createElement({classes: ['header'], textContent: 'Resodents'});84 let residentBlock = this._createElement({dataAttributes: {id: `demo${demo}`}, classes: ['accordion-body', 'collapse']});85 residentTr.append(residentTd);86 residentBlock.append(headBlock)87 residentTd.append(residentBlock);88 residentsArr.forEach(resident => {89 this._getData(resident).then(response => {90 let residentTable = this._createElement({classes: ['resident-table'], tagName: 'table'});91 let residentTBody = this._createElement({classes: ['resident-table'], tagName: 'tbody'});92 let residentTHead = this._createElement({classes: ['resident-table'], tagName: 'thead'});93 let headTr = this._createElement({tagName: 'tr'});94 let name = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'Name'});95 let BY = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'BY'});96 let created = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'created'});97 let EC = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'EC'});98 let gender = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'gender'});99 let HC = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'HC'});100 let height = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'height'});101 let HW = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'HW'});102 let mass = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'mass'});103 let SC = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: 'SC'});104 headTr.append(name, BY, created, EC, gender, HC, height, HW, mass, SC);105 let tableTr = this._createElement({tagName: 'tr'});106 let residentName = this._createElement({classes: ['resident-td'], tagName: 'td', textContent: response.name});107 let residentBY = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.birth_year});108 let residentCreated = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.created});109 let residentEC = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.eye_color});110 let residentGender = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.gender});111 let residentHC = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.hair_color});112 let residentHeight = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.height});113 let residentHW = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.homeworld});114 let residentMass = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.mass});115 let residentSC = this._createElement({classes: ['resident-td'],tagName: 'td', textContent: response.skin_color});116 residentTHead.append(headTr);117 tableTr.append(residentName, residentBY, residentCreated, residentEC, residentGender, residentHC, residentHeight, residentHW, residentMass, residentSC);118 residentTBody.append(tableTr);119 residentTable.append(residentTHead, residentTBody);120 residentBlock.append(residentTable);121 })122 })123 let planetTr = this._createElement({tagName: 'tr',dataAttributes: {'data-toggle':'collapse', 'data-target':`#demo${demo}`}, classes: ['accordion-toggle']});124 let planetName = this._createElement({tagName: 'td', textContent: name})125 let planetClimate = this._createElement({tagName: 'td', textContent: climate});126 let planetCreated = this._createElement({tagName: 'td', textContent: created});127 let planetDiameter = this._createElement({tagName: 'td', textContent: diameter});128 let planetEdited = this._createElement({tagName: 'td', textContent: edited});129 let planetGravity = this._createElement({tagName: 'td', textContent: gravity});130 let orbitalPeriod = this._createElement({tagName: 'td', textContent: orbital_period});131 let planetPopulation = this._createElement({tagName: 'td', textContent: population});132 let rotationPeriod = this._createElement({tagName: 'td', textContent: rotation_period});133 let surfaceWater = this._createElement({tagName: 'td', textContent: surface_water});134 let planetTerrain = this._createElement({tagName: 'td', textContent: terrain});135 let planetResidents = this._createElement({tagName: 'td', textContent: 'Residents'});136 planetTr.append(planetName, planetClimate, planetCreated, planetEdited, planetGravity, orbitalPeriod, planetPopulation, planetDiameter, planetResidents, rotationPeriod, surfaceWater, planetTerrain);137 this.tbody.append(planetTr, residentTr);138 })139 }140 }141 _followPromise = () => {142 this._getData('https://swapi.dev/api/planets').then(response => {143 let planetObj = response;144 this.planetsArr = planetObj.results;145 this._getPlanetsElements(this.planetsArr);146 })147 }148 _getData = (url) => {149 return new Promise((succeed, fail) => {...

Full Screen

Full Screen

dom-helper.js

Source:dom-helper.js Github

copy

Full Screen

...37 vm = null38 destroyDocument('foo')39 })40 it('create element with type', () => {41 var result = vm._createElement('bar')42 expect(result).is.an.object43 expect(result.type).eql('bar')44 expect(result.instanceId).eql('foo')45 })46})47describe('help create block', () => {48 var vm49 beforeEach(() => {50 vm = {51 _app: {doc: new Document('foo')}52 }53 Object.assign(vm, domHelper)54 })55 afterEach(() => {56 vm = null57 destroyDocument('foo')58 })59 it('create block with element', () => {60 var element = vm._app.doc.createElement('bar')61 var result = vm._createBlock(element)62 expect(result).is.an.object63 expect(result.start).is.an.object64 expect(result.end).is.an.object65 expect(result.start.type).eql('comment')66 expect(result.end.type).eql('comment')67 expect(result.start.value).eql('start')68 expect(result.end.value).eql('end')69 expect(result.element).equal(element)70 expect(result.element.children).eql([result.start, result.end])71 })72})73describe('help attach target', () => {74 var vm75 beforeEach(() => {76 vm = {77 _app: {doc: new Document('foo')}78 }79 Object.assign(vm, domHelper)80 })81 afterEach(() => {82 vm = null83 destroyDocument('foo')84 })85 it('attach body to documentElement', () => {86 var target = vm._createBody('bar')87 var dest = vm._app.doc.documentElement88 vm._attachTarget(target, dest)89 expect(dest.children).eql([target])90 })91 it('attach element to body', () => {92 var target = vm._createElement('bar')93 var dest = vm._createBody('baz')94 vm._attachTarget(target, dest)95 expect(dest.children).eql([target])96 })97 it('attach element to element', () => {98 var target = vm._createElement('bar')99 var dest = vm._createElement('baz')100 vm._attachTarget(target, dest)101 expect(dest.children).eql([target])102 })103 it('attach block to element', () => {104 var parent = vm._createElement('bar')105 var target = vm._createBlock(parent)106 var dest = vm._createElement('baz')107 vm._attachTarget(target, dest)108 expect(dest.children).eql([target.start, target.end])109 })110 it('attach element to block', () => {111 var target = vm._createElement('bar')112 var parent = vm._createElement('baz')113 var dest = vm._createBlock(parent)114 vm._attachTarget(target, dest)115 expect(parent.children).eql([dest.start, target, dest.end])116 })117 it('attach block to block', () => {118 var element = vm._createElement('bar')119 var target = vm._createBlock(element)120 var parent = vm._createElement('baz')121 var dest = vm._createBlock(parent)122 vm._attachTarget(target, dest)123 expect(parent.children).eql([124 dest.start, target.start, target.end, dest.end])125 })126 it('attach element to block with an update mark', () => {127 var target = vm._createElement('bar')128 var parent = vm._createElement('baz')129 var dest = vm._createBlock(parent)130 var mark = vm._createElement('qux')131 vm._attachTarget(target, dest)132 vm._attachTarget(mark, dest)133 expect(parent.children).eql([dest.start, target, mark, dest.end])134 dest.updateMark = mark135 vm._attachTarget(target, dest)136 expect(parent.children).eql([dest.start, mark, target, dest.end])137 expect(dest.updateMark).eql(target)138 })139 it('attach block to block with an update mark', () => {140 var element = vm._createElement('bar')141 var target = vm._createBlock(element)142 var parent = vm._createElement('baz')143 var dest = vm._createBlock(parent)144 var mark = vm._createElement('qux')145 vm._attachTarget(target, dest)146 vm._attachTarget(mark, dest)147 expect(parent.children).eql([148 dest.start, target.start, target.end, mark, dest.end])149 dest.updateMark = mark150 vm._attachTarget(target, dest)151 expect(parent.children).eql([152 dest.start, mark, target.start, target.end, dest.end])153 expect(dest.updateMark).eql(target.end)154 })155})156describe('help move target', () => {157 var vm, parent, dest, target1, block1, target2, block2, target3, block3158 beforeEach(() => {159 vm = {160 _app: {doc: new Document('foo')}161 }162 Object.assign(vm, domHelper)163 parent = vm._createElement('r')164 dest = vm._createBlock(parent)165 target1 = vm._createElement('t1')166 vm._attachTarget(target1, dest)167 block1 = vm._createBlock(dest)168 target2 = vm._createElement('t2')169 vm._attachTarget(target2, dest)170 block2 = vm._createBlock(dest)171 target3 = vm._createElement('t3')172 vm._attachTarget(target3, block2)173 block3 = vm._createBlock(block2)174 })175 afterEach(() => {176 vm = null177 destroyDocument('foo')178 })179 it('move an element to an element mark', () => {180 let mark181 expect(parent.children).eql([182 dest.start,183 target1, block1.start, block1.end,184 target2, block2.start,185 target3, block3.start, block3.end,186 block2.end,187 dest.end])188 mark = target2189 dest.updateMark = mark190 vm._moveTarget(target1, mark)191 expect(parent.children).eql([192 dest.start,193 block1.start, block1.end,194 target2, target1, block2.start,195 target3, block3.start, block3.end,196 block2.end,197 dest.end])198 })199 it('move an element to a block mark', () => {200 let mark = block2.end201 dest.updateMark = mark202 vm._moveTarget(target1, mark)203 expect(parent.children).eql([204 dest.start,205 block1.start, block1.end,206 target2, block2.start,207 target3, block3.start, block3.end,208 block2.end, target1,209 dest.end])210 })211 it('move a block to an element mark', () => {212 let mark = target2213 dest.updateMark = mark214 vm._moveTarget(block1, mark)215 expect(parent.children).eql([216 dest.start,217 target1,218 target2, block1.start, block1.end,219 block2.start,220 target3, block3.start, block3.end,221 block2.end,222 dest.end])223 })224 it('move a block to a block mark', () => {225 let mark = block2.end226 dest.updateMark = mark227 vm._moveTarget(block1, mark)228 expect(parent.children).eql([229 dest.start,230 target1,231 target2,232 block2.start,233 target3, block3.start, block3.end,234 block2.end, block1.start, block1.end,235 dest.end])236 })237 it('move a whole block to a block mark', () => {238 let mark = block1.end239 dest.updateMark = mark240 vm._moveTarget(block2, mark)241 expect(parent.children).eql([242 dest.start,243 target1, block1.start, block1.end,244 block2.start,245 target3, block3.start, block3.end,246 block2.end,247 target2,248 dest.end])249 })250})251describe('help remove target', () => {252 var vm253 beforeEach(() => {254 vm = {255 _app: {doc: new Document('foo')}256 }257 Object.assign(vm, domHelper)258 })259 afterEach(() => {260 vm = null261 destroyDocument('foo')262 })263 it('remove body', () => {264 var parent = vm._app.doc.documentElement265 var element = vm._createBody('baz')266 parent.appendChild(element)267 expect(parent.children).eql([element])268 vm._removeTarget(element)269 expect(parent.children).eql([])270 })271 it('remove element', () => {272 var parent = vm._createElement('bar')273 var element = vm._createElement('baz')274 parent.appendChild(element)275 expect(parent.children).eql([element])276 vm._removeTarget(element)277 expect(parent.children).eql([])278 })279 it('remove block', () => {280 var element = vm._createElement('baz')281 var prevElement = vm._createElement('prev')282 var nextElement = vm._createElement('next')283 var parent = vm._createElement('bar')284 vm._attachTarget(prevElement, parent)285 var block = vm._createBlock(parent)286 vm._attachTarget(element, block)287 vm._attachTarget(nextElement, parent)288 expect(parent.children).eql([289 prevElement, block.start, element, block.end, nextElement])290 vm._removeTarget(block)291 expect(parent.children).eql([292 prevElement, nextElement])293 })294 it('remove block but preserved itself', () => {295 var element = vm._createElement('baz')296 var prevElement = vm._createElement('prev')297 var nextElement = vm._createElement('next')298 var parent = vm._createElement('bar')299 vm._attachTarget(prevElement, parent)300 var block = vm._createBlock(parent)301 vm._attachTarget(element, block)302 vm._attachTarget(nextElement, parent)303 expect(parent.children).eql([304 prevElement, block.start, element, block.end, nextElement])305 vm._removeBlock(block, true)306 expect(parent.children).eql([307 prevElement, block.start, block.end, nextElement])308 })...

Full Screen

Full Screen

create_element.js

Source:create_element.js Github

copy

Full Screen

...8 constructor () {9 this._version = '0.05';10 }11 12 static _createElement(elemType, id, classList) {13 var elem = document.createElement(elemType);14 if (id && id != '') elem.id = id;15 CreateElement.addClassList(elem, classList);16 return elem;17 }18 19 static addClassList(elem, classList) {20 if (classList && classList != '') {21 var splitClass = classList.split(' ');22 for (var i = 0; i < splitClass.length; i++) {23 elem.classList.add(splitClass[i].trim());24 }25 }26 }27 28 static createDiv(id, classList, html, handler) {29 var elem = CreateElement._createElement('div', id, classList);30 if (html != null) elem.innerHTML = html;31 32 return elem;33 }34 35 static createSpan(id, classList, html) {36 var elem = CreateElement._createElement('span', id, classList);37 if (html != null) elem.innerHTML = html;38 39 return elem;40 }41 42 static createImage(id, classList, src, title, handler, dblclickhandler) {43 var elem = CreateElement._createElement('img', id, classList);44 if (src != null) elem.src = src;45 if (title) elem.title = title;46 if (handler) elem.addEventListener('click', handler, false);47 if (dblclickhandler) elem.addEventListener('dblclick', dblclickhandler, false);48 49 return elem;50 }51 52 static createIcon(id, classList, title, handler, dblclickhandler) {53 var elem = CreateElement._createElement('i', id, classList);54 if (title) elem.title = title;55 if (handler) elem.addEventListener('click', handler, false);56 if (dblclickhandler) elem.addEventListener('dblclick', dblclickhandler, false);57 58 return elem;59 }60 static createButton(id, classList, label, title, handler) {61 var elem = CreateElement._createElement('button', id, classList);62 if (label != null) elem.innerHTML = label;63 if (title != null) elem.title = title;64 if (handler) elem.addEventListener('click', e => handler(e), false);65 66 return elem;67 }68 69 static createLink(id, classList, content, title, href, handler) {70 var elem = CreateElement._createElement('a', id, classList);71 if (content) elem.innerHTML = content;72 if (title) elem.title = title;73 elem.href = href;74 if (handler) elem.addEventListener('click', handler, false);75 76 return elem;77 }78 static createTextArea(id, classList) {79 var elem = CreateElement._createElement('textarea', id, classList);80 81 return elem;82 }83 84 static createHR(id, classList) {85 var elem = CreateElement._createElement('hr', id, classList);86 87 return elem;88 }89 static createBR(id, classList) {90 var elem = CreateElement._createElement('br', id, classList);91 92 return elem;93 }94 static createSelect(id, classList, changehandler, values) {95 var elem = CreateElement._createElement('select', id, classList);96 if (changehandler) elem.addEventListener('change', changehandler, false);97 98 if (values) {99 for (var i = 0; i < values.length; i++) {100 var opt = CreateElement._createElement('option', null, null);101 if (values[i].hasOwnProperty('id')) opt.id = values[i].id;102 if (values[i].hasOwnProperty('value')) opt.value = values[i].value;103 opt.text = values[i].textval;104 elem.appendChild(opt);105 }106 } 107 108 return elem;109 }110 111 static createOption(id, classList, value, label) {112 var elem = CreateElement._createElement('option', id, classList);113 elem.value = value;114 elem.innerHTML = label;115 116 return elem;117 }118 119 static createTextInput(id, classList, initialContents) {120 var elem = CreateElement._createElement('input', id, classList);121 elem.type = 'text';122 if (initialContents) elem.value = initialContents;123 124 return elem;125 }126 127 static createCheckbox(id, classList, groupName, buttonValue, displayValue, checked, handler) {128 var container = CreateElement.createSpan(null, null);129 130 var elem = CreateElement._createElement('input', id, classList);131 elem.type = 'checkbox';132 elem.name = groupName;133 elem.value = buttonValue;134 if (checked) elem.checked = checked;135 if (handler) elem.addEventListener('click', e => handler(e), false);136 container.appendChild(elem);137 138 var label = CreateElement._createElement('label', id, classList);139 label.innerHTML = displayValue;140 container.appendChild(label);141 return container;142 }143 144 static createRadio(id, classList, groupName, buttonValue, displayValue, checked, handler) {145 var container = CreateElement.createSpan(null, null);146 147 var elem = CreateElement._createElement('input', id, classList);148 elem.type = 'radio';149 elem.name = groupName;150 elem.value = buttonValue;151 if (checked) elem.checked = checked;152 if (handler) elem.addEventListener('click', e => handler(e), false);153 container.appendChild(elem);154 155 var label = CreateElement._createElement('label', id, classList);156 label.htmlFor = id;157 label.innerHTML = displayValue;158 container.appendChild(label);159 return container;160 }161 162 static createTable(id, classList, headers, contents, captionLabel) {163 var table = CreateElement._createElement('table', id, classList);164 165 if (captionLabel) {166 var caption = table.createCaption();167 caption.innerHTML = captionLabel;168 }169 170 if (headers) {171 var thead = CreateElement._createElement('thead', null, null);172 table.appendChild(thead);173 var tr = CreateElement._createElement('tr', null, null);174 thead.appendChild(tr);175 for (var i = 0; i < headers.length; i++) {176 var th = CreateElement._createElement('th', null, null);177 th.innerHTML = headers[i];178 tr.appendChild(th);179 }180 }181 182 if (contents) {183 var tbody = CreateElement._createElement('tbody', null, null);184 table.appendChild(tbody);185 for (var i = 0; i < contents.length; i++) {186 var tr = CreateElement._createElement('tr', null, null);187 tbody.appendChild(tr);188 for (var j = 0; j < contents[i].length; j++) {189 var td = CreateElement._createElement('td', null, null);190 td.innerHTML = contents[i][j];191 tr.appendChild(td);192 }193 }194 }195 196 return table;197 }198 199 static createTableRow(id, classList, attachTo) {200 var elem = CreateElement._createElement('tr', id, classList);201 202 if (attachTo) attachTo.appendChild(elem);203 204 return elem;205 }206 207 static createTableCell(id, classList, contents, isHeader, attachTo) {208 var elem;209 if (isHeader) {210 elem = CreateElement._createElement('th', id, classList);211 } else {212 elem = CreateElement._createElement('td', id, classList);213 }214 215 elem.innerHTML = contents;216 217 if (attachTo) attachTo.appendChild(elem);218 219 return elem;220 } 221 222 static createSpinner(id, classList, value, minval, maxval, step) {223 var elem = CreateElement._createElement('input', id, classList);224 elem.type = 'number';225 if (value != null) elem.value = value;226 if (minval != null) elem.min = minval;227 if (maxval != null) elem.max = maxval;228 if (step) elem.step = step;229 230 return elem;231 }232 233 static createIframe(id, classList, src, width, height, allowfullscreen) {234 var elem = CreateElement._createElement('iframe', id, classList);235 elem.src = src;236 if (width != null) elem.width = width;237 if (height != null) elem.height = height;238 if (allowfullscreen != null) {239 elem.allowfullscreen = allowfullscreen;240 elem.mozallowfullscreen = allowfullscreen;241 elem.webkitallowfullscreen = allowfullscreen;242 }243 244 return elem;245 }246 247 static createUL(id, classList, values) {248 var elem = CreateElement._createElement('ul', id, classList);249 250 for (var i = 0; i < values.length; i++) {251 var item = CreateElement._createElement('li', null, null);252 item.innerHTML = values[i];253 elem.append(item);254 }255 256 return elem;257 }...

Full Screen

Full Screen

render.js

Source:render.js Github

copy

Full Screen

...43 document.getElementById(elParent).appendChild(el); 44 return el;45 };46 const _textContainer = (elId, elParent, title, txt, img = null) => { 47 _createElement(`big-container-${elId}`, elParent, 'div', ['big-container', 'stack', 'center']);48 _createElement(elId, `big-container-${elId}`, 'div', ['small-container', 'board']); 49 _createElement(`asset-container-${elId}`, elId, 'div', ['col-12', 'col-l-4', 'queue']);50 const image = _createElement(`asset-${elId}`, `asset-container-${elId}`, 'img', 'asset');51 if (img) { image.src = img;}52 _createElement(`text-container-${elId}`, elId, 'div', ['col-12', 'col-l-8', 'board']);53 _createElement(`title-container-${elId}`, `text-container-${elId}`, 'div', ['col-12', 'queue', 'center'])54 _createElement(`title-${elId}`, `title-container-${elId}`, 'div', 'subtitle')55 .innerHTML = '<h2>' + title + '</h2>';56 _createElement(`description-container-${elId}`, `text-container-${elId}`, 'div', ['col-12', 'queue', 'center']);57 _createElement(`description-${elId}`, `description-container-${elId}`, 'div', 'body-text')58 .innerHTML = txt;59 return image;60 };61 const _addContentTo = (elId, elParent, txt, img) => {62 _createElement(`sub-container-${elId}`, elParent, 'div', ['stack', 'center']);63 _createElement(elId, `sub-container-${elId}`, 'div', ['board', 'sub-container']); 64 _createElement(`img-container-${elId}`, elId, 'div', ['col-12', 'col-l-4']);65 const image = _createElement(`img-${elId}`, `img-container-${elId}`, 'img', 'sub-asset');66 if (img) { image.src = img }; 67 _createElement(`txt-container-${elId}`, elId, 'div', ['col-12', 'col-l-8', 'queue', 'column', 'center']);68 _createElement(`txt-${elId}`, `txt-container-${elId}`, 'div', ['body-text', 'item'])69 .innerHTML = txt;70 _createElement(`badge-container-${elId}`, elId, 'div', 'col-12');71 _createElement(`badge-github-${elId}`, `badge-container-${elId}`, 'img').src = '';72 _createElement(`badge-heroku-${elId}`, `badge-container-${elId}`, 'img').src = '';73 return image;74 };75 const _skillsContainer = (elId, elParent, title, body, obj) => {76 _createElement(`big-container-${elId}`, elParent, 'div', ['big-container', 'stack', 'center']);77 _createElement(elId, `big-container-${elId}`, 'div', ['small-container', 'board', 'between']);78 79 _createElement(`skill-block-${elId}`, elId, 'div', ['col-12', 'col-l-5']);80 const graph = _createElement(`skill-${elId}`, `skill-block-${elId}`, 'canvas');81 _createElement(`skill-desc-${elId}`, elId, 'div', ['col-12', 'col-l-6', 'queue', 'body-text'])82 .innerHTML = body; 83 return new Chart(graph, obj); // the bug is because of this84 };85 const aboutTab = () => {86 if (validations.containerPresence('about-container')) {87 return document.getElementById('about-container');88 } else {89 const container = _createElement('about-container', 'content', 'div', ['stack', 'no-space', 'board']);90 _textContainer('presentation-container', 'about-container', pageTxt.presentation.title, pageTxt.presentation.body, profilePic);91 return container92 }93 };94 const skillsTab = () => {95 if (validations.containerPresence('skills-container')) {96 return document.getElementById('skills-container');97 } else {98 const container = _createElement('skills-container', 'content', 'div', ['stack', 'no-space', 'board']);99 _skillsContainer('skill', 'skills-container', pageTxt.graphic.title, pageTxt.graphic.body, pageTxt.graphic.data);100 return container;101 }102 };103 const portfolioTab = () => {104 if (validations.containerPresence('portfolio-container')) {105 return document.getElementById('portfolio-container');106 } else {107 const container = _createElement('portfolio-container', 'content', 'div', ['stack', 'no-space', 'board']);108 const img = _textContainer('github-container', 'portfolio-container', pageTxt.portfolio.title, pageTxt.portfolio.body, githubSvg);109 img.onclick = () => window.open("https://github.com/heflerdev", "_blank")110 111 const gamePath = pageTxt.portfolio.projects.phaserGame;112 _addContentTo('github-sub-container', 'github-container', gamePath.description, gamePath.img)113 .onclick = () => { window.open("https://bats-and-caves.herokuapp.com/dist/", "_blank")};114 const socialPath = pageTxt.portfolio.projects.socialNetwork;115 _addContentTo('github-sub-container2', 'github-container', socialPath.description, socialPath.img)116 .onclick = () => { window.open("https://guarded-beach-33158.herokuapp.com/login", "_blank")};117 const cssPath = pageTxt.portfolio.projects.csStack;118 _addContentTo('github-sub-container3', 'github-container', cssPath.description, cssPath.img)119 .onclick = () => { window.open("https://github.com/HeflerDev/CSStack")};120 return container;121 }122 };123 const contactTab = () => {124 if (validations.containerPresence('contact-container')) {125 return document.getElementById('contact-container');126 } else {127 const container = _createElement('contact-container', 'content', 'div', ['stack', 'no-space', 'board']);128 _textContainer('talk-to-container', 'contact-container', pageTxt.contact.title, pageTxt.contact.body, gmailSvg)129 .onclick = () => { window.open("mailto:heflerdev@gmail.com", "_blank")};130 return container;131 }132 };133 return {134 listeners,135 aboutTab,136 skillsTab,137 contactTab,138 portfolioTab139 }140})();141export default render;

Full Screen

Full Screen

dom.js

Source:dom.js Github

copy

Full Screen

...61 var children = [];62 for (var _i = 2; _i < arguments.length; _i++) {63 children[_i - 2] = arguments[_i];64 }65 return _createElement(tag).apply(void 0, [attrs].concat(children));66}67exports.createElement = createElement;68exports.div = _createElement("div"), exports.span = _createElement("span"), exports.link = _createElement("link"), exports.style = _createElement("style"), exports.a = _createElement("a"), exports.p = _createElement("p"), exports.i = _createElement("i"), exports.pre = _createElement("pre"), exports.button = _createElement("button"), exports.label = _createElement("label"), exports.input = _createElement("input"), exports.select = _createElement("select"), exports.option = _createElement("option"), exports.optgroup = _createElement("optgroup"), exports.textarea = _createElement("textarea"), exports.canvas = _createElement("canvas"), exports.ul = _createElement("ul"), exports.ol = _createElement("ol"), exports.li = _createElement("li");69exports.nbsp = document.createTextNode("\u00a0");70function removeElement(element) {71 var parent = element.parentNode;72 if (parent != null) {73 parent.removeChild(element);74 }75}76exports.removeElement = removeElement;77function replaceWith(element, replacement) {78 var parent = element.parentNode;79 if (parent != null) {80 parent.replaceChild(replacement, element);81 }82}...

Full Screen

Full Screen

domUtil.js

Source:domUtil.js Github

copy

Full Screen

1import { isSafari } from "./util";2export function _createElement({ tagName, id, innerText, attrs, className }) {3 if (!tagName) throw "NoTagName";4 const elem = document.createElement(tagName);5 if (id) elem.id = id;6 if (innerText) elem.innerText = innerText;7 if (attrs) {8 Object.entries(attrs).forEach(([key, value]) => {9 elem.setAttribute(key, value);10 });11 }12 if (className) {13 elem.className = className;14 }15 return elem;16}17export function createDiv({ id, className, innerText } = {}) {18 return _createElement({ tagName: 'div', id: id, className: className, innerText: innerText });19}20export function createHr({ id, className } = {}) {21 return _createElement({ tagName: 'hr', id: id, className: className });22}23export function createLabel({ id, htmlFor, className, innerText } = {}) {24 const attrs = {};25 if (htmlFor) {26 attrs.for = htmlFor;27 }28 return _createElement({ tagName: 'label', id: id, className: className, innerText: innerText, attrs });29}30export function createAudio({ id, className, autoplay, muted, remote } = {}) {31 const attrs = {};32 const element = _createElement({ tagName: 'audio', id: id, className: className, attrs: attrs });33 element.autoplay = autoplay;34 element.muted = muted;35 if (remote && isSafari()) {36 element.controls = true;37 }38 return element;39}40export function createVideo({ id, className, autoplay, muted, remote } = {}) {41 const attrs = {42 playsinline: ''43 };44 const element = _createElement({ tagName: 'video', id: id, className: className, attrs: attrs });45 element.autoplay = autoplay;46 element.muted = muted;47 if (remote && isSafari()) {48 element.controls = true;49 }50 return element;51}52export function createInput({ id, className, placeholder } = {}) {53 const attrs = {};54 if (placeholder) {55 attrs.placeholder = placeholder;56 }57 return _createElement({ tagName: 'input', id: id, className: className, attrs });58}59export function createSelect({ id, className } = {}) {60 return _createElement({ tagName: 'select', id: id, className: className });61}62export function createOption({ id, className, value, innerText } = {}) {63 const attrs = {};64 if (value) {65 attrs.value = value;66 }67 return _createElement({68 tagName: 'option',69 id: id,70 className: className,71 innerText: innerText,72 attrs: attrs73 });74}75export function createCheckbox({ id, className } = {}) {76 return _createElement({77 tagName: 'input',78 id: id,79 className: className,80 attrs: { 'type': 'checkbox' }81 });82}83export function createButton({ id, className, innerText } = {}) {84 return _createElement({ tagName: 'button', id: id, className: className, innerText: innerText });85}86export function createImg({ id, className, src, alt, onerror } = {}) {87 const element = _createElement({88 tagName: 'img',89 id: id,90 className: className,91 attrs: { src, alt }92 });93 element.onerror = onerror;94 return element;95}96export function createParagraph({ id, className, innerText } = {}) {97 return _createElement({ tagName: 'p', id: id, className: className, innerText: innerText });98}99export function createList({ id, className } = {}) {100 return _createElement({ tagName: 'ul', id: id, className: className });101}102export function createListItem({ id, className } = {}) {103 return _createElement({ tagName: 'li', id: id, className: className });104}105export function replaceClassName(element, searchValue, newValue) {106 element.classList.replace(searchValue, newValue);107}108export function hasClassName(element, searchValue) {109 return (element.classList.value.indexOf(searchValue) !== -1);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium, _createElement } = require('playwright');2async function run() {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 const element = await page.$('input[type="text"]');6 const handle = await element.asElement();7 const internalHandle = await handle._elementHandle;8 const internalElement = await _createElement(internalHandle);9 console.log(internalElement);10 await browser.close();11}12run();13ElementHandle {context: Context, initializer: {…}, channel: Channel, disposed: false, guid: "element-1"}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { test } = require('@playwright/test');2test('test', async ({ page }) => {3 const element = await page._createElement('div');4 await page.setContent('<div id="test">Hello</div>');5 await page.click('div#test');6 await page.click(element);7});8 ✕ test (2ms)9 50 | const element = await page._createElement('div');10 51 | await page.setContent('<div id="test">Hello</div>');11 > 52 | await page.click('div#test');12 53 | await page.click(element);13 54 | });14 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:100:13)15 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)16 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)17 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)18 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)19 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)20 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)21 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)22 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)23 at ElementHandle._clickablePoint (node_modules/playwright/lib/server/dom.js:102:24)24const { test } = require('@playwright/test');25test('test', async ({ page }) => {26 const element = await page._createElement('div');27 await page.setContent('<div id="test">Hello</div>');28 await page.click(element);29});30 ✕ test (2

Full Screen

Using AI Code Generation

copy

Full Screen

1const { _createElement } = require('playwright/lib/server/dom');2const element = _createElement('div', { id: 'myDiv' }, []);3console.log(element);4const { _createTextNode } = require('playwright/lib/server/dom');5const textNode = _createTextNode('This is a text node');6console.log(textNode);7const { _createDocument } = require('playwright/lib/server/dom');8const document = _createDocument('This is a document');9console.log(document);10const { _createDocumentFragment } = require('playwright/lib/server/dom');11const documentFragment = _createDocumentFragment();12console.log(documentFragment);13const { _createComment } = require('playwright/lib/server/dom');14const comment = _createComment('This is a comment');15console.log(comment);16const { _createEvent } = require('playwright/lib/server/dom');17const event = _createEvent('click');18console.log(event);19const { _createMouseEvent } = require('playwright/lib/server/dom');20const mouseEvent = _createMouseEvent('click');21console.log(mouseEvent);22const { _createKeyboardEvent } = require('playwright/lib/server/dom');23const keyboardEvent = _createKeyboardEvent('keydown');24console.log(keyboardEvent);25const { _createWheelEvent } = require('playwright/lib/server/dom');26const wheelEvent = _createWheelEvent('wheel');27console.log(wheelEvent);28const { _createHTMLOrSVGElement } = require('playwright/lib/server/dom');29const htmlOrSvgElement = _createHTMLOrSVGElement('div', { id: 'myDiv' }, []);30console.log(htmlOrSvgElement);31const { _

Full Screen

Using AI Code Generation

copy

Full Screen

1const { _createElement } = require('playwright/lib/server/dom');2const element = _createElement('a');3console.log(element.href);4const { _dispatchEvent } = require('playwright/lib/server/dom');5const element = _createElement('a');6_dispatchEvent(element, 'click');7const { _setFileInputFiles } = require('playwright/lib/server/dom');8const element = _createElement('input');9element.type = 'file';10_setFileInputFiles(element, ['test.txt'], '/home/username/');11console.log(element.files);12const { _setFileInputFiles } = require('playwright/lib/server/dom');13const element = _createElement('input');14element.type = 'file';15_setFileInputFiles(element, ['test.txt'], '/home/username/');16console.log(element.files);17const { _setFileInputFiles } = require('playwright/lib/server/dom');18const element = _createElement('input');19element.type = 'file';20_setFileInputFiles(element, ['test.txt'], '/home/username/');21console.log(element.files);22const { _setFileInputFiles } = require('playwright/lib/server/dom');23const element = _createElement('input');24element.type = 'file';25_setFileInputFiles(element, ['test.txt'], '/home/username/');26console.log(element.files);27const { _setFileInputFiles } = require('playwright/lib/server/dom');28const element = _createElement('input');29element.type = 'file';30_setFileInputFiles(element, ['test.txt'], '/home/username/');31console.log(element.files);32const { _setFileInputFiles } = require('playwright/lib/server/dom');33const element = _createElement('input');34element.type = 'file';35_setFileInputFiles(element, ['test.txt'], '/home/username/');36console.log(element.files);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { InternalAPI } = require('playwright/lib/server/frames');2const internalAPI = new InternalAPI();3internalAPI._createElement({ tagName: 'div' });4const { InternalAPI } = require('playwright/lib/server/frames');5const internalAPI = new InternalAPI();6internalAPI._createElement({ tagName: 'div' });7const { InternalAPI } = require('playwright/lib/server/frames');8const internalAPI = new InternalAPI();9internalAPI._createElement({ tagName: 'div' });10const { InternalAPI } = require('playwright/lib/server/frames');11const internalAPI = new InternalAPI();12internalAPI._createElement({ tagName: 'div' });13const { InternalAPI } = require('playwright/lib/server/frames');14const internalAPI = new InternalAPI();15internalAPI._createElement({ tagName: 'div' });16const { InternalAPI } = require('playwright/lib/server/frames');17const internalAPI = new InternalAPI();18internalAPI._createElement({ tagName: 'div' });19const { InternalAPI } = require('playwright/lib/server/frames');20const internalAPI = new InternalAPI();21internalAPI._createElement({ tagName: 'div' });22const { InternalAPI } = require('playwright/lib/server/frames');23const internalAPI = new InternalAPI();24internalAPI._createElement({ tagName: 'div' });25const { InternalAPI } = require('playwright/lib/server/frames');26const internalAPI = new InternalAPI();27internalAPI._createElement({ tagName: 'div' });28const { InternalAPI } = require('playwright

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Internal } = require('playwright/lib/internal');2const internal = new Internal();3const element = internal._createElement('div', { id: 'myId' });4console.log(element);5const { Internal } = require('playwright/lib/internal');6const internal = new Internal();7const document = internal._createDocument();8console.log(document);9const { Internal } = require('playwright/lib/internal');10const internal = new Internal();11const textNode = internal._createTextNode('Hello World');12console.log(textNode);13const { Internal } = require('playwright/lib/internal');14const internal = new Internal();15const comment = internal._createComment('Hello World');16console.log(comment);17const { Internal } = require('playwright/lib/internal');18const internal = new Internal();19const cdataSection = internal._createCDATASection('Hello World');20console.log(cdataSection);21const { Internal } = require('playwright/lib/internal');22const internal = new Internal();23const processingInstruction = internal._createProcessingInstruction('Hello World');24console.log(processingInstruction);25const { Internal } = require('playwright/lib/internal');26const internal = new Internal();27const documentType = internal._createDocumentType('Hello World');28console.log(documentType);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { _createElement } = require('playwright/lib/client/elementHandler');2const element = _createElement(page, 'div#id');3await element.waitForElementState('visible');4await element.click();5const { expect } = require('chai');6const { test, expect } = require('@playwright/test');7const test = require('@playwright/test');8const { expect } = require('chai');9test('Test', async ({ page }) => {10 await page.click('text=Get started');11 await page.click('text=Docs');12 await page.click('text=API');13 await page.click('text=Page');14 await page.click('text=class Page');15 await page.click('text=click');16 await page.click('text=selector');17 await page.click('text=string');18 await page.click('text=Options');19 await page.click('text=timeout');20 await page.click('text=number');21 await page.click('text=timeout');22 await page.click('text=number');23 await page.click('text=force');24 await page.click('text=boolean');25 await page.click('text=position');26 await page.click('tex

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful