With FakeDb, we can mock content items. Each tree node can be created by the DbItem class. DbItem class has three constructors as below. public DbItem(string name); public DbItem(string name, ID id); public DbItem(string name, ID id, ID templateId); When your code is calling GetItem with the Sitecore.Data.ID object, you …
A NuGet package, Sitecore.FakeDb helps us to test functions that use Sitecore API. It is a mock memory database where you can remove the dependencies and isolate the code. When you create a brand-new test project, setting up FakeDb can be tricky. Installing FakeDb and adding the usual two Sitecore …
Now that we created a cool components with rendering parameters (see Using Rendering Parameters to Inject Data into Hidden Input), we can write a unit test. Sitecore’s Rendering class has a publicly accessible string field called Parameters. This is the rendering parameter string get populated on page rendering. Mocking is …
What are rendering parameters? They are the additional key-value pair data you can feed to the Sitecore component in addition to data source. The textbook example would be adding an additional CSS class to the component. Content authors can customise the style of the component, like background colour or button …
Setting up AB tests or even multivariate tests in Sitecore is simple as long as the page is implemented correctly. The key to easily create AB tests is to components. There are a few ways of setting up tests in Sitecore. In this post, let’s create tests by using data …
Sitecore has out of the box capability to record customers’ behaviours throughout their journey across the channels. We can customise the way to capture customers’ behaviours by registering our own custom events, failure events, goals and outcomes and use them to create personalisation. This out of the box analytics capability …
Data source for Sitecore component provide data points to be used in the components, such as controller renderings or view renderings. Content author can easily edit those data points (e.g. header title, body text or CSS style) to customise components. It is one of the techniques to make Sitecore component …
Creating a visual reference for Sitecore items is important for content authors as well as developers. The recommended practice (or I would say mandatory) for creating an template is to assign a distinguishable icon for easier visual reference. If you know this trick, you can go one step further to …
The way JavaScript handles scope is unique. It makes the language so fascinating to learn. It is so different from any other major programming languages. JavaScript has many quirks that make it so fascinating, such as its asynchronous nature, event loops, prototypes, closure and so on. I think this is …
Redux-thunk is a simple middleware that enables you to call functions in redux action. Thunk means function returning function. In JavaScript programming, we use thunk all the time although we may not use the name. Wikipedia has a simple example of thunk if you are interested. As the name suggests, …