Ng-Tag-input minLength not set property - ng-tags-input

I use this library in my ionic project (Cross platform mobile application), And I try to set minLength : 1 but it takes default value (i.e. 3). How can i achieve this?

Set the min-length="1" property to the <auto-complete> instead of <tags-input> to get suggestions for every character.
like this:
<tags-input ng-model="vm.tags">
<auto-complete source="vm.loadTags($query)"
min-length="1"
highlightMatchedText="true">
</auto-complete>
</tags-input>
Even I spent a few hours figuring out how to do it, it later flashed me when I read the documentation of autoComplete again.
http://mbenford.github.io/ngTagsInput/documentation/api#autoComplete

Related

Ionic IOS ngx-translate

i have any problems with ngx.translate on IOS.
On android device all function perfectly but on IOS ngx-traslate not work.
In the main view i can choose the language, if i choose "fr" i set "fr" in db and then i take the value from db and use : this.translate.use(lng);
In db i change correctly the value, indeed the json that i download (in other views) is with the right language, but the variable on html code {{ 'MONTH.JENUARY' | translate }} it don't take the value.
Why on ios not work?
I tried to update ngx-translate, i tried to use ionViewWillEnter, but I don't understand because it works on android and not on ios
can someone help me?

How to get pseudo elements in WebdriverIO+Appium

I want to get a value (content) from the CSS of a pseudo element (::before) while inside a test made using WDIO and Appium for an Android hybrid app because the designer has stored the current responsive-design state there. So my tests would know which layout (elements) to expect.
Multiple answers to related questions (1; 2; 3) indicated that using .getComputedStyle() might be the only solution. But this does not seem to work in my tests. The error is window is not defined for window.getComputedStyle(...) or document is not defined if I use document.defaultView.getComputedStyle(...). Also selectors themselves can't address pseudo-elements it seems.
Example of one of my many attempts:
document.defaultView.getComputedStyle($('body'),'::before').getPropertyValue('content')
Question: Do I need to somehow import window or document to my test? Is there some other way to get window or document from inside the test?
Ultimately: how can I get the content value of ::before of the <body> of a hybrid Android app?
Thanks to Jeremy Schneider (#YmerejRedienhcs) & Erwin Heitzman (#erwinheitzman) for help!
One solution is to use the execute function:
let contentMode = browser.execute(() => {
let style = document.defaultView.getComputedStyle(document.querySelector('body'),'::before');
return style.getPropertyValue('content')
});
Alternatively maybe something could also be done with getHTML.

How Automatically On "Content Blocker" Extension in Safari section?

I am creating an Ad Blocker. I am just trying to Automatically on safari extension of "Content Blocker". I went through examples but did't found any solution. Is there any way to "ON" extension or manually we have to start it?
On iOS, Safari Content Blockers are disabled by default.
There is no way to automatically enable them from your app. You must instruct the user to:
Open the Settings app.
Go to Safari > Content Blockers.
Toggle on your Content Blocker extension.
On macOS (as of 10.12), a similar rule applies: Content Blocker extensions (bundled with your app) are disabled by default, and must be toggled on by the user in Safari Preferences > Extensions.
Assuming you want to test your "personal AdBlock program", first prepare a dummy HTML, with this line <div class="ads">hello</div>,
next apply your "personal AdBlock program", assuming it is JavaScript/CSS based and not proxy-like, you either hide, or remove the element (Node) from the DOM.
for example:
document.querySelector('div[class*="ads"]') -- this is nice and (very) generic way to find the element.
this is how to hide "the ads"
document.querySelector('div[class*="ads"]').style.display="none";
or, to make it stronger, related to other rules on the page, make it a local style + important notifier: document.querySelector('div[class*="ads"]').style.cssText="display:none !important;" ;
you can also remove the element (Node) from the DOM:
var e = document.querySelector('div[class*="ads"]') follow by:
e.parentNode.removeChild(e);
now, you probably want to see that "YOUR ADBLOCK" worked,
later (after the page has loaded, and your javascript code runned) type:
console.log(null === document.querySelector('div[class*="ads"]') ? "removed(success)" : "still here(failed)")
note that for this example (to make things simple) I assume there is only one div with that class in the page (avoiding loops :) ).
if you've just going to hide the element, you should query its current (most updated) style-condition, using a native method exist under window:
console.log("none" === window.getComputedStyle(document.querySelector('div[class*="ads"]')) ? "hidden(success)" : "still here(failed)")
Enjoy!

Change progressbar color

I have a progressbar in my form and I need to change its color. I need it to be Yellow and so I am using this code:
SendMessage(ProgressBar5.Handle, PBM_SETBARCOLOR, 0, clYellow);
I am using Lazarus and I couldn't use the SendMessage(); procedure. Then I have googled a bit and I found that I need to include in the uses the lclintf library.
Now I have another hassle because Lazarus can't recognize the parameter PBM_SETBARCOLOR. In fact it states:
unit5.pas(245,50) Error: Identifier not found "PBM_SETBARCOLOR";
I see that the first line of code that I wrote is the only way to change the color of a ProgressBar from green to the one I need.
Any help? I am using the latest version of Lazarus.
The PBM_SETBARCOLOR is declared in the commctrl.pp unit of freepascal, same as in Delphi.
You could also declare it as a constant with value 1033 (WM_USER + 9).

Use WatiN for automation upload file on the website

I need upload file on the website.
But Have a problem, i can't choose file automatic in code. Always browser show me choose file window.
What wrong in my code?
IE ie = new IE("https://www.xxxx.com/WFrmlogin.aspx");
FileUploadDialogHandler uploadHandler = new FileUploadDialogHandler(#"D:\065-6405_URGENT.xls");
ie.WaitForComplete();
ie.TextField(Find.ById("txtUser")).TypeText("login");
ie.TextField(Find.ById("txtPassWord")).TypeText("***");
ie.Button(Find.ById("btnok")).Click();
ie.WaitForComplete();
ie.GoTo("https://www.orientspareparts.com/inq/WFrmUpOption.aspx");
ie.WaitForComplete();
ie.DialogWatcher.Clear();
ie.AddDialogHandler(uploadHandler);
// This code show choose file dialog
ie.FileUpload(Find.ById("FilUpload")).ClickNoWait();
ie.Button(Find.ById("butUpload")).Click();
ie.WaitForComplete();
I had the same problem. I'm using a GMail-like upload process, so I wanted to test actual use-cases. Just setting the Text property on my hidden file input wasn't an option.
I ended up using SendKeys to type the path to my file, then sent "{ENTER}" to submit the dialog.
SetForegroundWindow(browser.hWnd);
SendKeys.SendWait("{ENTER}");
Thread.Sleep(500); // An unfortunate necessity, to give the dialog time to pop up.
SendKeys.SendWait(#"C:\myfile.jpg{ENTER}")
I don't love this solution, especially not the sleep, but it was the best I could do in under 30 mins.
If anyone has a better option, let me know!
Why do you need to select from the Dialog? Try to just set the Text:
ie.FileUpload(Find.ById("profile_file")).Text = "C:/Desktop/image.jpg";
I guess you might talk to the fellow who asked this question:
WatiN File Upload

Resources