I was wondering how I would be able to test for text using Protractor when part of my text contains a link to a separate page.
Is there a way to expand the link and get the raw text to expect that?
Should I use something similar to:
expect(myText).toContain("Some text <a href="..."")
Thanks
If the text is a link, you can use following locator for the same
expect(element(by.linkText('Google')).getTagName()).toBe('a');
This is in case when link is like this in DOM
Google
Source: Software Automata - Protractor – Locators
Related
Does anyone know of a ready-made plugin that allows adding input, textarea, select etc. on tinymce?
The tinymce.dom.Selection API (https://www.tiny.cloud/docs/api/tinymce.dom/tinymce.dom.selection/#select) allows you to select elements or set content in the TinyMCE editor. You can assign the API class to an action or an interaction element like a button or form, and any selected content will be replaced with the contents the API action passes in.
If that's not a good fit for what you need, is there an example of the type of adding input, a textarea, or a select you're looking for?
There are no official plugins that allow such interactive elements to be added. TinyMCE is a text editor that is built to create blog posts, articles, etc. By design, it is not a page builder. However, there may be some unofficial plugins on GitHub that may implement such features.
If you are going to insert forms and text areas that should not be edited or reconfigured afterward, you can use templates. They may come as any valid HTML. Thus, some fixed forms can be just saved as templates.
Another way is, of course, inserting HTML directly into the code.
I am using Tinymce in a textarea form field to add 'Rich text Editing' to the field. (Form Method = POST).
I used this tutorial to install the files.
In the form itself.. the editor works great.
However....
ISSUE: When my form results are produced, the results include the raw text and source code, instead of the formatted text.
Obviously... the Tinymce plugin has several files and folders. But....
If anyone has experience with the Tinymce plugin, perhaps I am making a rookie, generic, first time error???
Any guidance would be helpful. Thanks.
I figured it out. In my php, I just had to remove htmlspecialchars
Ok, this seems simple but I've been scratching my head over this.
When I go to "inspect elements", and I see this (for example):
<div class="topbar">
I can use search to find "topbar", but not the whole thing (with the ">").
Is there some simple way to search for all text, including the html part, using google chrome's devtools?
A quick way to try and work around this is to use the selector, in this case .topbar when searching. It appears that currently the string selection only searches content text, not the DOM structure.
If you want to see if the search can get updated we always welcome new bug reports. The DevTools group doesn't mind feature requests through this system. Please have "DevTools" in the title so it is easy for any triager to know where to send it.
I want to set my textarea in my php project with texteditor like Stackoverflow's. So I can input Text Code in special format display. Is there any plugin like that in PHP?
Creating text with some markup syntax is usally done on the client-side and not server-side, which is why I would recommend you look for a javascript-wysiwyg-editor.
Check out this link for an overview.
Check out this Blog Post for info on how WMD Markdown Editor is used on Stack Exchange (as answered in this Meta question).
I have a requirement where I HAVE TO use bootstrap autocomplete dropdown, BUT user can have free form text in that dropdown if they wish. Before you think about TypeAhead, I could use Bootstrap TypeAhead textbox, but I need to have the dropdown becasue we want to give some default values as headstart options in case users dont know what to search for.
I am using this with MVC DropDownListFor as that creates a select control for us.
I found this article which does that for me.
https://github.com/danielfarrell/bootstrap-combobox/pull/20
All I had to do was take off the name from the select control and the control was letting me enter free form text. All good so far.
Now, I am using this in conjunction with Knockoutjs. I bind my options and selected value to the select control and then on row rendered of my template, I called (selector).combobox() which makes the select control a bootstrap comobobox and adds an input control and hides the select control in the scenes behind.
The problem now is when I try to get he values to post to server, since the value I put in input box is not a valid options from the options I gave to select control, it is always setting it to the first option by default. This is becasue, I set the binding of the selected value on select control and not on the input box which was created by bootstrap-combobox.js.
My question is how do I get the input box to data-bind to the same porperty as the the select control was bound to.
Any other options??
Let me know if you need more clarification or have questions.
Please suggest.
Thanks.
Have a look at Select2 for Bootstrap. It should be able to do everything you need.
Another good option is Selectize.js. It feels a bit more native to Bootstrap.
Does the basic HTML5 datalist work? It's clean and you don't have to play around with the messy third party code. W3SCHOOL tutorial
The MDN Documentation is very eloquent and features examples.
Select2 for Bootstrap 3 native plugin
https://fk.github.io/select2-bootstrap-css/index.html
this plugin uses select2 jquery plugin
nuget
PM> Install-Package Select2-Bootstrap
Fuel UX combobox has all the features you would expect.
Can i suggest http://www.jqueryscript.net/form/Twitter-Like-Mentions-Auto-Suggesting-Plugin-with-jQuery-Bootstrap-Suggest.html, works more like the twitter post suggestion where it gives you a list of users or topics based on # or # tags,
view demo here: http://www.jqueryscript.net/demo/Twitter-Like-Mentions-Auto-Suggesting-Plugin-with-jQuery-Bootstrap-Suggest/
in this one you can easily change the # and # to anything you want
Bootstrap Tokenfield seems good too: http://sliptree.github.io/bootstrap-tokenfield/